cubec commited on
Commit
4d89218
·
verified ·
1 Parent(s): aad057d

Publish 2603-view indoor evaluation dataset and restore instructions

Browse files
README.md CHANGED
@@ -143,3 +143,19 @@ The prepared data does not replace access agreements for original source assets.
143
  ![3D-FRONT visible masks](previews/3dfront/train-overlay.png)
144
 
145
  [Posed object geometry](previews/3dfront/train-geometry.glb)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
143
  ![3D-FRONT visible masks](previews/3dfront/train-overlay.png)
144
 
145
  [Posed object geometry](previews/3dfront/train-geometry.glb)
146
+
147
+ <!-- partprobe3d-frozen-evaluation:start -->
148
+ ## Frozen indoor evaluation
149
+
150
+ The optional [indoor evaluation bundle](optional/evaluation/indoor/README.md) contains 2,603 images with visible masks and GT object meshes.
151
+ It includes all 100 PICASSO images, all 1,503 MessyKitchens images, and 1,000 random 3D-FRONT test views.
152
+ The transfer is 23.40 GB.
153
+ MessyKitchens shares 100 GT scene meshes across its views.
154
+ Default training downloads exclude this bundle.
155
+
156
+ Apply the loader patch described in the bundle documentation before evaluating its samples.
157
+
158
+ ```bash
159
+ python -m preprocess.huggingface download --repo cubec/PartProbe3D-preprocessed --dataset indoor --optional evaluation
160
+ ```
161
+ <!-- partprobe3d-frozen-evaluation:end -->
code/evaluation.patch CHANGED
@@ -13,6 +13,224 @@ index f3de37d..c9cba24 100644
13
  "capture": CaptureLoader,
14
  "combined": CombinedLoader,
15
  "extent": ExtentLoader,
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
16
  diff --git a/dataloader/frozen.py b/dataloader/frozen.py
17
  new file mode 100644
18
  index 0000000..2a43518
 
13
  "capture": CaptureLoader,
14
  "combined": CombinedLoader,
15
  "extent": ExtentLoader,
16
+ diff --git a/evaluation/artifacts.py b/evaluation/artifacts.py
17
+ index d61612c..8cb65e6 100644
18
+ --- a/evaluation/artifacts.py
19
+ +++ b/evaluation/artifacts.py
20
+ @@ -1,12 +1,17 @@
21
+ """Shared previews, result records and Markdown reports."""
22
+ from collections import Counter
23
+ +import hashlib
24
+ import json
25
+ import os
26
+ from pathlib import Path
27
+ +from threading import Lock
28
+ +from uuid import uuid4
29
+
30
+ import numpy as np
31
+ from PIL import Image, ImageDraw, ImageFont
32
+
33
+ +from utils.hashing import gt_hash
34
+ +
35
+ from .glb import validate_input, write_prediction
36
+
37
+
38
+ @@ -226,8 +231,56 @@ def sample_record(sample, index):
39
+ "visibility": sample.visibility, "dataset_metadata": sample.metadata}
40
+
41
+
42
+ -def prepare_sample(folder, sample, provenance, gt_name="ground_truth.glb"):
43
+ +def link_ground_truth(source, destination):
44
+ + """Atomically replace a view's GT path with a relative link."""
45
+ + source, destination = Path(source), Path(destination)
46
+ + if destination.is_symlink() and destination.resolve() == source.resolve():
47
+ + return
48
+ + temporary = destination.with_name(f".{destination.name}.{uuid4().hex}")
49
+ + try:
50
+ + temporary.symlink_to(os.path.relpath(source.resolve(), destination.parent.resolve()))
51
+ + os.replace(temporary, destination)
52
+ + finally:
53
+ + temporary.unlink(missing_ok=True)
54
+ +
55
+ +
56
+ +class GroundTruthStore:
57
+ + """Store each scene mesh once and retain the GT path for every view."""
58
+ + def __init__(self, directory):
59
+ + self.directory = Path(directory)
60
+ + self._lock = Lock()
61
+ + self._written = set()
62
+ +
63
+ + def target(self, digest, coordinate_frame, identity_mode, provenance):
64
+ + signature = {"gt_sha256": digest, "coordinate_frame": coordinate_frame,
65
+ + "identity_mode": identity_mode, "provenance": provenance}
66
+ + key = hashlib.sha256(json.dumps(signature, sort_keys=True).encode()).hexdigest()
67
+ + return self.directory / f"{key}.glb"
68
+ +
69
+ + def write(self, destination, sample, provenance, digest):
70
+ + identity = sample.metadata.get("input_mask_identity", "mask")
71
+ + target = self.target(digest, sample.gt_coordinate_frame, identity, provenance)
72
+ + with self._lock:
73
+ + if target not in self._written:
74
+ + target.parent.mkdir(parents=True, exist_ok=True)
75
+ + temporary = target.with_name(f".{uuid4().hex}.glb")
76
+ + try:
77
+ + write_prediction(temporary, sample.gt_meshes,
78
+ + coordinate_frame=sample.gt_coordinate_frame, units="m",
79
+ + identity_mode=identity, method="ground-truth", provenance=provenance)
80
+ + os.replace(temporary, target)
81
+ + finally:
82
+ + temporary.unlink(missing_ok=True)
83
+ + self._written.add(target)
84
+ + link_ground_truth(target, destination)
85
+ +
86
+ +
87
+ +def prepare_sample(folder, sample, provenance, gt_name="ground_truth.glb", *, gt_store=None, gt_digest=None):
88
+ previews(folder, sample.rgb, sample.masks)
89
+ + if gt_store is not None and sample.gt_coordinate_frame == "model_scene":
90
+ + gt_store.write(folder / gt_name, sample, provenance,
91
+ + gt_digest if gt_digest is not None else gt_hash(sample.gt_meshes))
92
+ + return
93
+ write_prediction(folder / gt_name, sample.gt_meshes, coordinate_frame=sample.gt_coordinate_frame,
94
+ units="m", identity_mode=sample.metadata.get("input_mask_identity", "mask"),
95
+ method="ground-truth", provenance=provenance)
96
+ diff --git a/evaluation/evaluate.py b/evaluation/evaluate.py
97
+ index e50d3ea..318de5c 100644
98
+ --- a/evaluation/evaluate.py
99
+ +++ b/evaluation/evaluate.py
100
+ @@ -12,7 +12,7 @@ from dataloader.registry import DATASETS
101
+ from .glb import write_prediction
102
+ from .inference import METHODS
103
+ from .inference.base import REPO_ROOT
104
+ -from .artifacts import prepare_sample, previews, report, sample_record, save_json
105
+ +from .artifacts import GroundTruthStore, prepare_sample, previews, report, sample_record, save_json
106
+ from .arguments import output_paths
107
+ from .predictions import MeshPredictions
108
+ from . import workflows
109
+ @@ -53,6 +53,8 @@ def main(argv=None):
110
+ select.add_argument("--count", type=int, default=8)
111
+ select.add_argument("--workers", type=int, default=1,
112
+ help="Concurrent CPU readers for selection preparation")
113
+ + compact = commands.add_parser("compact-selection", help="Share duplicate GT meshes in a frozen selection")
114
+ + compact.add_argument("--selection", required=True)
115
+ infer.add_argument("--method", choices=METHODS, required=True)
116
+ infer.add_argument("--config", required=True, help="JSON constructor kwargs for the inference class")
117
+ for sub in (select, meshes):
118
+ @@ -79,6 +81,15 @@ def main(argv=None):
119
+ return 0
120
+ if hasattr(args, "samples") and args.samples < 32:
121
+ parser.error("--samples must be at least 32")
122
+ + if args.command == "compact-selection":
123
+ + selection_path = Path(args.selection).resolve()
124
+ + output_paths(parser, selection_path.parent, REPO_ROOT, no_report=True)
125
+ + try:
126
+ + result = workflows.compact_selection(selection_path)
127
+ + except (ValueError, KeyError, FileNotFoundError) as exc:
128
+ + parser.error(str(exc))
129
+ + print(json.dumps(result, indent=2))
130
+ + return 0
131
+ if args.command == "select" and args.workers < 1:
132
+ parser.error("--workers must be positive")
133
+ if args.command == "meshes":
134
+ @@ -181,6 +192,7 @@ def main(argv=None):
135
+ if selected and any(index not in selected for index in indices):
136
+ parser.error("--indices/--index must belong to the frozen selection")
137
+ rows = []
138
+ + gt_store = GroundTruthStore(output / "ground_truth")
139
+ for index in indices:
140
+ frame = loader[index]
141
+ if selected:
142
+ @@ -194,7 +206,8 @@ def main(argv=None):
143
+ ) if args.input else None
144
+ if source_prediction is not None and source_prediction.resolve() == gt_path.resolve():
145
+ gt_path = folder / "scoring_ground_truth.glb"
146
+ - prepare_sample(folder, frame, loader.provenance(), gt_path.name)
147
+ + prepare_sample(folder, frame, loader.provenance(), gt_path.name, gt_store=gt_store,
148
+ + gt_digest=selected[index]["gt_sha256"] if selected else None)
149
+ row = {**sample_record(frame, index), "status": "ok", "ground_truth_glb": gt_path.name}
150
+ prediction = folder / "prediction.glb"
151
+ started = time.perf_counter()
152
+ diff --git a/evaluation/workflows.py b/evaluation/workflows.py
153
+ index 3968d22..5f985e0 100644
154
+ --- a/evaluation/workflows.py
155
+ +++ b/evaluation/workflows.py
156
+ @@ -11,9 +11,10 @@ import traceback
157
+ import numpy as np
158
+ from PIL import Image
159
+
160
+ -from utils.hashing import gt_hash, input_hashes
161
+ +from utils.hashing import gt_hash, input_hashes, sha256
162
+
163
+ -from .artifacts import prepare_sample, report, sample_record, sample_statistics, sample_statistics_table, save_json
164
+ +from .artifacts import (GroundTruthStore, link_ground_truth, prepare_sample, report, sample_record,
165
+ + sample_statistics, sample_statistics_table, save_json)
166
+ from dataloader.registry import DATASETS
167
+ from .glb import read_prediction, write_prediction
168
+ from .metrics import MATCHING_VERSION, SCENE_ALIGNMENT_VERSION, TETRIS3D_ALIGNMENT_VERSION, evaluate
169
+ @@ -123,11 +124,14 @@ def select(args, output):
170
+ "sampling": "uniform samples without replacement; sorted population indices",
171
+ "population_frames": len(loader), "frames": []}
172
+ provenance = manifest["dataset_provenance"]
173
+ + gt_store = GroundTruthStore(output / "ground_truth")
174
+ def prepare(index):
175
+ sample = loader[index]
176
+ - prepare_sample(output / "inputs" / sample.key, sample, provenance)
177
+ + digest = gt_hash(sample.gt_meshes)
178
+ + prepare_sample(output / "inputs" / sample.key, sample, provenance,
179
+ + gt_store=gt_store, gt_digest=digest)
180
+ return {**sample_record(sample, index), **input_hashes(sample.rgb, sample.masks),
181
+ - "gt_sha256": gt_hash(sample.gt_meshes)}
182
+ + "gt_sha256": digest}
183
+ workers = getattr(args, "workers", 1)
184
+ if workers == 1:
185
+ manifest["frames"] = [prepare(index) for index in indices]
186
+ @@ -140,6 +144,47 @@ def select(args, output):
187
+ return 0
188
+
189
+
190
+ +def compact_selection(selection_path):
191
+ + """Share byte-identical GT exports without changing a frozen selection."""
192
+ + selection_path = Path(selection_path).resolve()
193
+ + selection = read_json(selection_path)
194
+ + root = selection_path.parent
195
+ + store = GroundTruthStore(root / "ground_truth")
196
+ + groups = {}
197
+ + original_inodes = {}
198
+ + for frame in selection["frames"]:
199
+ + path = root / "inputs" / frame["key"] / "ground_truth.glb"
200
+ + if not path.parent.resolve().is_relative_to(root / "inputs"):
201
+ + raise ValueError(f"GT path must remain inside the selection inputs: {path}")
202
+ + target = store.target(frame["gt_sha256"], frame["gt_coordinate_frame"],
203
+ + frame.get("dataset_metadata", {}).get("input_mask_identity", "mask"),
204
+ + selection["dataset_provenance"])
205
+ + digest = sha256(path)
206
+ + info = path.stat()
207
+ + original_inodes[(info.st_dev, info.st_ino)] = info.st_size
208
+ + group = groups.setdefault(target, {"digest": digest, "paths": [], "bytes": info.st_size})
209
+ + if digest != group["digest"]:
210
+ + raise ValueError(f"GT exports with the same geometry contain different bytes: {path}")
211
+ + group["paths"].append(path)
212
+ + # Validate all existing files before replacing any view paths.
213
+ + for target, group in groups.items():
214
+ + if target.exists() and sha256(target) != group["digest"]:
215
+ + raise ValueError(f"Shared GT export differs from the frozen files: {target}")
216
+ + store.directory.mkdir(parents=True, exist_ok=True)
217
+ + for target, group in groups.items():
218
+ + if not target.exists():
219
+ + # A hard link retains the verified bytes while view paths change.
220
+ + os.link(group["paths"][0], target, follow_symlinks=True)
221
+ + for path in group["paths"]:
222
+ + link_ground_truth(target, path)
223
+ + result = {"views": len(selection["frames"]), "unique_gt_meshes": len(groups),
224
+ + "previous_unique_bytes": sum(original_inodes.values()),
225
+ + "shared_gt_bytes": sum(group["bytes"] for group in groups.values()),
226
+ + "selection_sha256": sha256(selection_path)}
227
+ + save_json(root / "ground_truth_storage.json", result)
228
+ + return result
229
+ +
230
+ +
231
+ def collect_runs(run, selection):
232
+ """Collect recorded model outputs and disjoint shards by their method metadata."""
233
+ expected = {frame["key"]: frame for frame in selection["frames"]}
234
  diff --git a/dataloader/frozen.py b/dataloader/frozen.py
235
  new file mode 100644
236
  index 0000000..2a43518
code/evaluation_manifest.json CHANGED
@@ -1,8 +1,11 @@
1
  {
2
  "base_git_revision": "290027fe9f281a21db978a48da21bb9be90e5517",
3
- "patch_sha256": "4e996043fd61be711cb2fba624f89107040c1fe99dacbce7ba42c4067e47e765",
4
  "files": {
5
  "dataloader/registry.py": "97690914f4c50c9f7d31213bb9dab174bc740cdd62bf7b217ccfe456b6b387e7",
 
 
 
6
  "dataloader/frozen.py": "5efdb2209519d556f363599226d0d511de14009529899813b48a5574432bc508",
7
  "preprocess/evaluation.py": "e6c72bb985e38e219885db4dbc2c68d31c5f6dcac2a8c0f9fcd37aa86565ba19",
8
  "evaluation/configs/picasso_frozen.json": "39a3bbd78f4a5014624c8a190669154a52013af374bbdd2253d549ff981dab2b",
 
1
  {
2
  "base_git_revision": "290027fe9f281a21db978a48da21bb9be90e5517",
3
+ "patch_sha256": "02a780a4df7abbfb37090beb86664d026b4dcc0d945fc7927a8621d4bf2d7fd0",
4
  "files": {
5
  "dataloader/registry.py": "97690914f4c50c9f7d31213bb9dab174bc740cdd62bf7b217ccfe456b6b387e7",
6
+ "evaluation/artifacts.py": "232f1b6ffd0374813ea93857ecb378c317a962b2bfbbb4cce0fd7d28e88fe12c",
7
+ "evaluation/evaluate.py": "3d9115be9eb34e1e6193a31f3fb4e5bf770f60b70701dbf7d67017376b87ed17",
8
+ "evaluation/workflows.py": "0623408a288a31d5502531f377c5492b985b5dc69429858d21180eaf0b06d2ba",
9
  "dataloader/frozen.py": "5efdb2209519d556f363599226d0d511de14009529899813b48a5574432bc508",
10
  "preprocess/evaluation.py": "e6c72bb985e38e219885db4dbc2c68d31c5f6dcac2a8c0f9fcd37aa86565ba19",
11
  "evaluation/configs/picasso_frozen.json": "39a3bbd78f4a5014624c8a190669154a52013af374bbdd2253d549ff981dab2b",
optional/evaluation/indoor/README.md ADDED
@@ -0,0 +1,78 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # PartProbe3D frozen indoor evaluation
2
+
3
+ This bundle contains 2,603 single-image evaluation samples and their GT object meshes.
4
+ It requires about 23.4 GB, including RGB images, visible masks, previews, and shared geometry.
5
+ It contains no training samples, depth maps, model weights, or image features.
6
+
7
+ | Dataset | Images | Unique GT exports | Selection |
8
+ | --- | ---: | ---: | --- |
9
+ | PICASSO | 100 | 100 | All released images from ten scenes |
10
+ | MessyKitchens | 1,503 | 100 | All released images from 100 scenes |
11
+ | 3D-FRONT | 1,000 | 1,000 | Random prepared test views with seed 42, without replacement |
12
+
13
+ The 3D-FRONT population contains 10,066 prepared views from 935 test rooms.
14
+ The selected views cover 635 rooms and retain their test assignments.
15
+ Each MessyKitchens scene has one GT export, shared across its views through relative manifest paths.
16
+ All archive members contain regular files.
17
+
18
+ ## Restore
19
+
20
+ Use the PartProbe3D checkout at Git revision `290027fe9f281a21db978a48da21bb9be90e5517`.
21
+ Apply the supplied loader patch to that checkout:
22
+
23
+ ```bash
24
+ hf download cubec/PartProbe3D-preprocessed code/evaluation.patch --repo-type dataset --local-dir outputs/huggingface/bootstrap
25
+ git apply --check outputs/huggingface/bootstrap/code/evaluation.patch
26
+ git apply outputs/huggingface/bootstrap/code/evaluation.patch
27
+ python -m pip install -e '.[preprocess]'
28
+ python -m preprocess.huggingface download --repo cubec/PartProbe3D-preprocessed --dataset indoor --optional evaluation
29
+ ```
30
+
31
+ The downloader pins one Hub revision and verifies every archive checksum before restoration.
32
+ The optional bundle restores to `datasets/evaluation/indoor/`.
33
+ Default training downloads exclude this bundle.
34
+ The source manifest at `code/evaluation_manifest.json` records the loader files and patch checksum.
35
+
36
+ ## Read samples
37
+
38
+ ```python
39
+ from dataloader.frozen import FrozenEvaluationLoader
40
+
41
+ dataset = FrozenEvaluationLoader('datasets/evaluation/indoor/messykitchen')
42
+ sample = dataset[0]
43
+ rgb, masks, meshes = sample.rgb, sample.masks, sample.gt_meshes
44
+ ```
45
+
46
+ Use `--dataset frozen` for shared evaluation commands.
47
+ The configuration files are `evaluation/configs/picasso_frozen.json`, `evaluation/configs/messykitchen_frozen.json`, and `evaluation/configs/front3d_frozen.json`.
48
+ Original source datasets are unnecessary for this loader.
49
+
50
+ ```bash
51
+ python -m evaluation.evaluate select --dataset frozen \
52
+ --dataset-config evaluation/configs/messykitchen_frozen.json \
53
+ --count 1503 --seed 42 --workers 4 --output outputs/evaluation/messykitchen_frozen
54
+ ```
55
+
56
+ Each dataset contains `manifest.json`, `source_selection.json`, `views/`, and `ground_truth/`.
57
+ The manifest records file checksums, original sample indices, mask settings, and dataset provenance.
58
+ RGB pixels and mask labels preserve their frozen selection checksums.
59
+ GT files preserve the original exported GLB bytes and their float32 vertex representation.
60
+ The original geometry hash remains provenance under `source_gt_sha256`.
61
+
62
+ PICASSO and 3D-FRONT GT meshes use OpenCV camera coordinates in meters.
63
+ MessyKitchens GT meshes use the registered scene coordinates in meters.
64
+ Its SAM3 masks have no released GT correspondence or camera calibration.
65
+ Use scene-relative alignment for MessyKitchens scoring.
66
+
67
+ ## Sources and terms
68
+
69
+ Original dataset terms continue to apply to their images and meshes.
70
+ This derived bundle introduces no replacement license for source data.
71
+
72
+ - [PICASSO official release](https://github.com/MIT-SPARK/Picasso#data) supplies RGB images, instance annotations, object meshes, and poses.
73
+ - [MessyKitchens official project](https://github.com/MessyKitchens/MessyKitchens) supplies the real photographs and registered scene meshes under CC BY-NC 4.0.
74
+ - [3D-FRONT official project](https://tianchi.aliyun.com/specials/promotion/alibaba-3d-scene-dataset) supplies the rooms and furniture used for our rendered test views.
75
+
76
+ MessyKitchens authors are Junaid Ahmed Ansari, Ran Ding, Fabio Pizzati, and Ivan Laptev.
77
+ Its original dataset card and citation remain in `messykitchen/SOURCE_README.md`.
78
+ PartProbe3D adds predicted SAM3 masks for MessyKitchens and prepares the 3D-FRONT captures.
training/index.json CHANGED
@@ -84,6 +84,17 @@
84
  "evaluation/ycbv": {
85
  "component": "optional/evaluation/ycbv",
86
  "bytes": 1669857280
 
 
 
 
 
 
 
 
 
 
 
87
  }
88
  },
89
  "base_git_revision": "aac7b493e1e5e10512857a2582233c99fedda9c5"
 
84
  "evaluation/ycbv": {
85
  "component": "optional/evaluation/ycbv",
86
  "bytes": 1669857280
87
+ },
88
+ "evaluation/indoor": {
89
+ "component": "optional/evaluation/indoor",
90
+ "bytes": 23404277760,
91
+ "views": 2603,
92
+ "datasets": {
93
+ "picasso": 100,
94
+ "messykitchen": 1503,
95
+ "3dfront": 1000
96
+ },
97
+ "loader_patch": "code/evaluation.patch"
98
  }
99
  },
100
  "base_git_revision": "aac7b493e1e5e10512857a2582233c99fedda9c5"