Deterministic scene-level benchmark dataset. Each __getitem__ returns all fixed frames of one scene, used for model inference and evaluation. No randomness, no data augmentation. Data layout (SpatialBenchmark, pre-split by view_density): / / /<sc
| 102 | |
| 103 | |
| 104 | class BenchmarkDataset(torch.utils.data.Dataset): |
| 105 | """Deterministic scene-level benchmark dataset. |
| 106 | |
| 107 | Each __getitem__ returns all fixed frames of one scene, used for model inference and evaluation. |
| 108 | No randomness, no data augmentation. |
| 109 | |
| 110 | Data layout (SpatialBenchmark, pre-split by view_density): |
| 111 | <benchmark_root>/<density>/<dataset>/<scene_path>/{images,depths,poses,intrinsics,...,meta.json} |
| 112 | Where density in {single, sparse, medium, dense}; each scene folder's images/ is already filtered |
| 113 | per frame, so use list(range(n_frames)) as positional indices to load all frames of the scene. |
| 114 | |
| 115 | Args: |
| 116 | scene_index_path: path to scene_index.json (e.g. all_scenes.json) |
| 117 | benchmark_root: SpatialBenchmark root directory |
| 118 | tags: tag filter (e.g. ["sparse", "indoor"]) |
| 119 | tag_operator: "AND" or "OR" |
| 120 | max_scenes: maximum number of scenes (used for quick testing) |
| 121 | conf_threshold: Ropedia confidence threshold |
| 122 | """ |
| 123 | |
| 124 | # ImageNet normalization |
| 125 | IMG_NORM = T.Compose([ |
| 126 | T.ToTensor(), |
| 127 | T.Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225]), |
| 128 | ]) |
| 129 | |
| 130 | # SpatialBenchmark root pre-split by density (per-frame data is read from here): |
| 131 | # <root>/<density>/<dataset>/<scene_path>/{images,depths,...,meta.json} |
| 132 | DEFAULT_BENCHMARK_ROOT = "SpatialBenchmark" |
| 133 | |
| 134 | def __init__(self, |
| 135 | scene_index_path, |
| 136 | benchmark_root=None, |
| 137 | tags=None, |
| 138 | tag_operator="AND", |
| 139 | max_scenes=None, |
| 140 | resolution_override=None, |
| 141 | conf_threshold=0.3, |
| 142 | shuffle_seed=None, |
| 143 | priority_datasets=None): |
| 144 | |
| 145 | self.registry = TagRegistry(scene_index_path) |
| 146 | self.shuffle_seed = shuffle_seed |
| 147 | |
| 148 | # Filter scenes |
| 149 | if tags: |
| 150 | self.scenes = self.registry.query(tags, operator=tag_operator) |
| 151 | else: |
| 152 | self.scenes = self.registry.scenes |
| 153 | |
| 154 | if max_scenes: |
| 155 | self.scenes = self.scenes[:max_scenes] |
| 156 | |
| 157 | # Move high-VRAM / OOM-prone datasets to the front of the queue, so OOM is triggered on the |
| 158 | # first scene; combined with run_dense_benchmark.py's OOM detection this kills the process |
| 159 | # immediately and skips to the next model |
| 160 | if priority_datasets: |
| 161 | priority_set = set(priority_datasets) |
no outgoing calls
no test coverage detected