anon-cmevs-2026 commited on
Commit
77731f3
·
verified ·
1 Parent(s): 42e91cb

Initial release: metadata, code, adapters (v1.0; scenes/ in next commit)

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. CHANGELOG.md +31 -0
  2. LICENSE.md +39 -0
  3. README.md +156 -0
  4. SHA256SUMS +88 -0
  5. TODO.md +83 -0
  6. adapters/README.md +64 -0
  7. adapters/hm3d/README.md +43 -0
  8. adapters/hm3d/config.yaml +17 -0
  9. adapters/hm3d/metadata/source_manifest.json +412 -0
  10. adapters/hm3d/pipeline.py +0 -0
  11. adapters/ob3d/README.md +35 -0
  12. adapters/ob3d/config.yaml +41 -0
  13. adapters/ob3d/metadata/source_manifest.json +35 -0
  14. adapters/ob3d/reencoding_script.md +68 -0
  15. adapters/scannetpp/README.md +38 -0
  16. adapters/scannetpp/config.yaml +17 -0
  17. adapters/scannetpp/metadata/source_manifest.json +511 -0
  18. adapters/scannetpp/pipeline.py +1967 -0
  19. adapters/tartanground/README.md +37 -0
  20. adapters/tartanground/config.yaml +43 -0
  21. adapters/tartanground/metadata/source_manifest.json +800 -0
  22. adapters/tartanground/reencoding_script.md +68 -0
  23. blender_indoor/README.md +92 -0
  24. blender_indoor/SHA256SUMS +0 -0
  25. blender_indoor/metadata/frame_id_mapping.csv +0 -0
  26. blender_indoor/metadata/frame_manifest.csv +0 -0
  27. blender_indoor/metadata/scene_id_mapping.csv +375 -0
  28. blender_indoor/metadata/source_manifest.json +29 -0
  29. blender_indoor/metadata/splits.json +388 -0
  30. code/LICENSE +22 -0
  31. code/README.md +70 -0
  32. code/README_REPRODUCE.md +95 -0
  33. code/configs/base_erpt.yaml +142 -0
  34. code/configs/blender_indoor.yaml +17 -0
  35. code/configs/blender_outdoor.yaml +17 -0
  36. code/configs/default.yaml +22 -0
  37. code/configs/hm3d.yaml +17 -0
  38. code/configs/scannetpp.yaml +17 -0
  39. code/configs/tiny.yaml +15 -0
  40. code/core/__init__.py +35 -0
  41. code/core/coordinate.py +191 -0
  42. code/core/depth_estimation.py +185 -0
  43. code/core/depth_fusion.py +769 -0
  44. code/core/erp_projection.py +277 -0
  45. code/core/erp_warp.py +591 -0
  46. code/core/tangent_extraction.py +566 -0
  47. code/data/README.md +16 -0
  48. code/dataset_metadata/croissant.json +308 -0
  49. code/environment.yml +25 -0
  50. code/examples/metadata/candidates.jsonl +7 -0
CHANGELOG.md ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Changelog
2
+
3
+ All notable changes to CM-EVS are documented here. The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
4
+
5
+ ## [v1.0.0] — 2026-05-02 (initial release)
6
+
7
+ ### Added
8
+
9
+ - **Blender indoor data drop**: 374 scene instances (`sence_indoor_0001 … sence_indoor_0374`), 13,631 ERP RGB frames + 12,634 range-depth NumPy arrays + 13,631 pose JSON files. Resolution 2048×1024. CC-BY 4.0.
10
+ - **Blender indoor metadata**: `source_manifest.json`, `splits.json` (scene-level 70/15/15 via `sha256(scene_id) % 100`), `frame_manifest.csv` (14 columns matching the Croissant RecordSet schema), `scene_id_mapping.csv` and `frame_id_mapping.csv` (back-references to original H100 round1+2 / round2 sampling).
11
+ - **Per-archive integrity**: `blender_indoor/SHA256SUMS` (39,896 lines covering panorama + depth + pose).
12
+ - **Adapter packages** for the four license-restricted sources: HM3D (401 rooms), ScanNet++ (500 scans), OB3D (24 instances, outdoor), TartanGround (762 parts, outdoor). Each package contains README, config, pipeline / re-encoding script, and `metadata/source_manifest.json` listing the upstream scene IDs needed to reproduce the curator's selection.
13
+ - **Curator source code** (`code/`): MIT-licensed core modules (`core/`), scripts (`scripts/`), helper tools (`tools/`), metadata schemas (`metadata_examples/`), tiny example (`examples/tiny_blender_scene/`), `environment.yml`, `requirements.txt`.
14
+ - **Croissant v1.0 metadata** (`croissant.json`): conforms to <http://mlcommons.org/croissant/1.0>; passes `mlcroissant 1.1.0` validator. 12 distribution entries (Blender archive + 4 FileSets + 4 adapter packages + code + docs + frame-manifest), 1 RecordSet (`erp-frame-records`) with 14 fields, 9 RAI extension fields.
15
+ - **Datasheet** (in `README.md`) following Gebru et al. 2021.
16
+ - **License matrix** (`LICENSE.md`).
17
+ - **Top-level integrity manifest** (`SHA256SUMS`) covering all non-data files.
18
+ - **Pre-push checklist** (`TODO.md`).
19
+
20
+ ### Notes
21
+
22
+ - The paper's headline numbers `326 scenes / 11,583 frames` describe the **curator-selected subset**, not the full data drop. v1.0 stages the underlying 374 / 13,631; the curator-selected subset will be derived after the §5 evaluation experiments finalize and posted as v1.1.
23
+ - **HM3D / ScanNet++ / TartanGround / OB3D**: zero RGB-D frames are redistributed under any license. The adapter packages reproduce matching frames on the user's machine after upstream access is granted.
24
+ - Frame numbers within each Blender scene are renumbered consecutively (`panorama_0000 … panorama_NNNN`); `frame_id_mapping.csv` records the back-reference to the original H100 file path for traceability.
25
+
26
+ ### Known gaps (tracked in `TODO.md`)
27
+
28
+ - §5 evaluation result CSVs are still placeholders (coverage / oracle / lambda sweep / cross-source / 50-frame audit).
29
+ - `frame_quality.csv` (per-frame invalid-depth + exposure stats) requires running `code/scripts/audit_quality.py` over the 13,631 frames.
30
+ - Curator-only fields in `frame_manifest.csv` (`viewpoint_score`, `coverage_gain`, `conflict_ratio`, `candidate_id`) are intentionally empty in v1.0 because the curator has not yet run on the merged 374-scene set.
31
+ - Real `sha256` and `contentUrl` for each `cr:FileObject` in `croissant.json` will be filled when the actual distributable archives are packaged.
LICENSE.md ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # CM-EVS License Matrix
2
+
3
+ CM-EVS combines redistributable synthetic frames, license-aware adapter scripts, and metadata derived from upstream datasets that have their own access terms. **This release is mixed-license.** Please consult the per-component table below before redistribution or commercial use.
4
+
5
+ | Component | Source license | CM-EVS release license | Notes |
6
+ | --- | --- | --- | --- |
7
+ | Blender indoor frames (`blender_indoor/scenes/`) | CC0 / CC-BY 4.0 source assets | **CC-BY 4.0** | Redistributable. Includes RGB, range-depth, pose, and metadata for 374 scene instances / 13,631 frames. |
8
+ | HM3D adapter (`adapters/hm3d/`) | code: original; metadata: Matterport / HM3D EULA | **MIT** (code) + upstream EULA (scene ids and any HM3D-derived metadata) | No derived RGB-D frames are redistributed. Users must independently accept HM3D's EULA before running the adapter. |
9
+ | ScanNet++ adapter (`adapters/scannetpp/`) | code: original; metadata: ScanNet++ ToS | **MIT** (code) + upstream ToS (scan ids and any ScanNet++-derived metadata) | No derived RGB-D frames are redistributed. Users must accept the ScanNet++ ToS. |
10
+ | OB3D adapter (`adapters/ob3d/`) | code: original; metadata: per upstream OB3D | **MIT** (code) + upstream license (any OB3D-derived metadata) | Outdoor re-encoding adapter. No data redistributed. |
11
+ | TartanGround adapter (`adapters/tartanground/`) | code: original; metadata: per upstream TartanGround / TartanAir | **MIT** (code) + upstream license (any TartanGround-derived metadata) | Outdoor re-encoding adapter. No data redistributed. |
12
+ | Curator source code (`code/`) | original | **MIT** | Includes core modules, scripts, tools, metadata schemas, tiny example. |
13
+ | Documentation (`README.md`, `LICENSE.md`, `CHANGELOG.md`, `TODO.md`, `*/README.md`) | original | **CC-BY 4.0** | Datasheet, Croissant metadata, and per-source READMEs. |
14
+ | Croissant metadata (`croissant.json`) | original | **CC-BY 4.0** | MLCommons Croissant v1.0; passes mlcroissant 1.1 validator. |
15
+
16
+ ## Important constraints
17
+
18
+ - **Blender indoor**: CC-BY 4.0 — attribution required if redistributed or used commercially. Cite the dataset paper (see `README.md`).
19
+ - **HM3D / ScanNet++ / TartanGround / OB3D**: regenerated frames produced by running the adapters here remain bound by the **upstream license** of each source. The MIT license on the adapter code does **not** override upstream terms for those frames.
20
+ - **Synthetic-real gap**: this dataset includes synthetic Blender renders. Synthetic-only results should not be used as evidence for real-scan performance without further validation; see paper §6 limitations.
21
+
22
+ ## Attribution
23
+
24
+ If you use the Blender indoor data or curator code, please cite:
25
+
26
+ ```bibtex
27
+ @inproceedings{cmevs2026,
28
+ title={{CM-EVS}: A Coverage-Curated Panoramic {RGB-D} Dataset for Indoor Scene Understanding},
29
+ author={Anonymous Author(s)},
30
+ booktitle={NeurIPS 2026 Datasets and Benchmarks Track (under review)},
31
+ year={2026}
32
+ }
33
+ ```
34
+
35
+ For full text of the licenses referenced above, see:
36
+ - CC-BY 4.0: <https://creativecommons.org/licenses/by/4.0/legalcode>
37
+ - MIT: <https://opensource.org/licenses/MIT>
38
+ - HM3D EULA: <https://aihabitat.org/datasets/hm3d/>
39
+ - ScanNet++ ToS: <https://kaldir.vc.in.tum.de/scannetpp/>
README.md ADDED
@@ -0,0 +1,156 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: other
3
+ license_name: cm-evs-mixed
4
+ language:
5
+ - en
6
+ size_categories:
7
+ - 10K<n<100K
8
+ task_categories:
9
+ - depth-estimation
10
+ - image-to-image
11
+ tags:
12
+ - panoramic
13
+ - equirectangular
14
+ - erp
15
+ - rgb-d
16
+ - viewpoint-selection
17
+ - view-planning
18
+ - data-curation
19
+ - 3d-scene
20
+ - indoor-scene-understanding
21
+ - world-model
22
+ - novel-view-synthesis
23
+ pretty_name: CM-EVS — Coverage-Curated Panoramic RGB-D Dataset
24
+ ---
25
+
26
+ # CM-EVS: A Coverage-Curated Panoramic RGB-D Dataset for Indoor Scene Understanding
27
+
28
+ CM-EVS is a curated panoramic RGB-D dataset built under a single principle: **maximize the geometric coverage of a 3D scene with the fewest equirectangular (ERP) frames possible**. The release is structured as one redistributable Blender indoor data archive plus four license-aware adapter packages that regenerate matched frames locally from upstream sources whose terms forbid redistribution.
29
+
30
+ > **v1.0 status**: this version stages the **full Blender indoor data drop** (374 scene instances, 13,631 ERP RGB-depth-pose frames; 201 from the round1+2 sampling and 173 from round2). The paper's headline `326 scenes / 11,583 frames` is the curator-selected subset that will be derived from this drop after the §5 evaluation experiments finalize. See `TODO.md` for items still in flight.
31
+
32
+ ## Dataset summary
33
+
34
+ | Source | License | Released here | Scenes / frames |
35
+ | --- | --- | --- | --- |
36
+ | **Blender indoor** | CC-BY 4.0 | **Full data** (`blender_indoor/`) | 374 / 13,631 |
37
+ | HM3D | upstream EULA | Adapter only (`adapters/hm3d/`) | 401 rooms / regen-only |
38
+ | ScanNet++ | upstream ToS | Adapter only (`adapters/scannetpp/`) | 500 scans / regen-only |
39
+ | OB3D (outdoor) | upstream license | Adapter only (`adapters/ob3d/`) | 24 / regen-only |
40
+ | TartanGround (outdoor) | upstream license | Adapter only (`adapters/tartanground/`) | 762 parts / regen-only |
41
+
42
+ The Blender indoor frames are the only redistributable RGB-D data. For the four restricted sources, this dataset ships the per-source adapter (config + pipeline script + scene-id metadata); users obtain upstream data themselves and run the adapter locally to reproduce matching ERP frames under the unified schema.
43
+
44
+ ## Output schema
45
+
46
+ Every released ERP frame follows a single coordinate convention:
47
+
48
+ - World frame: right-handed, `+X` right, `+Y` up, `+Z` forward
49
+ - Camera frame: OpenCV (`+x` image right, `+y` image down, `+z` camera forward)
50
+ - Pose: scalar-first quaternion `q_wc = [w, x, y, z]` plus position `C_w − C_{w,0}` relative to the scene's first selected frame (the absolute first-frame center is recorded once per scene in `meta.json` when present)
51
+ - ERP pixel coords: longitude `(u/W − 0.5) · 2π`, latitude `(0.5 − v/H) · π`
52
+ - Range depth: each pixel stores radial distance from camera center to surface (not perspective `z`-depth). NaN or 0 marks invalid pixels.
53
+
54
+ | File | Format | Description |
55
+ | --- | --- | --- |
56
+ | `panorama_{NNNN}.png` | PNG, 2048×1024 | ERP RGB image |
57
+ | `panorama_{NNNN}_depth.npy` | float32 array | ERP range depth (m); NaN or 0 if invalid; absent for some frames where depth was not produced |
58
+ | `pose_{NNNN}.json` | JSON | `q_wc`, position, `camera_type` |
59
+
60
+ Per-scene `meta.json`, `metadata/selected_viewpoints.json`, `metadata/candidates.jsonl`, `metadata/per_step_log.jsonl` (curator-only) will land here once the curator runs on the merged 374-scene set; see `TODO.md`.
61
+
62
+ ## Directory layout
63
+
64
+ ```
65
+ cmevs_hf_release/
66
+ ├── README.md (this file — HF dataset card)
67
+ ├── LICENSE.md (mixed-license matrix)
68
+ ├── CHANGELOG.md
69
+ ├── croissant.json (MLCommons Croissant v1.0; passes mlcroissant 1.1 validator)
70
+ ├── SHA256SUMS (top-level checksums, excluding blender_indoor/scenes/)
71
+ ├── TODO.md (pre-push checklist)
72
+ ├── blender_indoor/
73
+ │ ├── README.md
74
+ │ ├── scenes/sence_indoor_{0001..0374}/{panorama,pose}_{NNNN}.{png,npy,json}
75
+ │ ├── SHA256SUMS (39,896 lines for 13,631 frames × ~3 files)
76
+ │ └── metadata/{source_manifest.json, splits.json, frame_manifest.csv,
77
+ │ scene_id_mapping.csv, frame_id_mapping.csv}
78
+ ├── adapters/{hm3d, scannetpp, ob3d, tartanground}/
79
+ │ ├── README.md
80
+ │ ├── config.yaml
81
+ │ ├── pipeline.py / reencoding_script.md
82
+ │ └── metadata/source_manifest.json
83
+ ├── code/ (curator core modules + scripts; reviewer reference)
84
+ └── results/ (paper §5 result CSVs; placeholders to be filled)
85
+ ```
86
+
87
+ ## Datasheet
88
+
89
+ Following Gebru et al. 2021. (Source: `main.tex` Appendix A — content here is a faithful markdown rendering; cross-check against the paper PDF.)
90
+
91
+ ### Motivation
92
+
93
+ **Purpose.** Evaluates fixed-budget panoramic viewpoint curation policies on existing 3D assets, and provides reproducible ERP RGB-D-pose samples for panoramic perception experiments.
94
+
95
+ **Creators / funding.** Anonymized during double-blind review; finalized in camera-ready.
96
+
97
+ ### Composition
98
+
99
+ **Instances.** Each instance is an ERP frame triple (RGB image + range-depth array + camera pose), plus per-scene `meta.json` and curator-only provenance metadata.
100
+
101
+ **Counts.** v1.0 stages 13,631 ERP frames across 374 Blender indoor scene instances (CC-BY 4.0). The four restricted sources (HM3D / ScanNet++ / OB3D / TartanGround) ship adapters only; users regenerate matching frames locally.
102
+
103
+ **Sampling.** Indoor (Blender) frames are produced offline by Cycles ERP rendering. The 374 scene instances comprise 201 from round1+2 (Blender_indoor_FOU_threshold-0.2, rounds 1+2 merge) and 173 from round2 (independent extraction). 48 original `sence_indoor_XXXX` ids appear in both rounds with different sampling outcomes; both versions are kept and renumbered (see `blender_indoor/metadata/scene_id_mapping.csv` for traceability). Outdoor source trajectories (TartanGround, OB3D) are re-encoded into the unified schema by the `adapters/{tartanground,ob3d}/` pipelines; the curator does not run on outdoor sources in v1.0.
104
+
105
+ **Fields.** RGB PNG (2048×1024 for Blender indoor; native source resolution otherwise), float32 range depth (`.npy`), pose JSON with scalar-first `q_wc`, `meta.json`, candidate / viewpoint / per-step-log metadata (curator-produced frames only), source / scene / split ids.
106
+
107
+ **Missing values.** Invalid depth pixels are NaN or 0 by source convention; per-frame invalid-depth ratio statistics will land in `results/frame_quality.csv` (see TODO).
108
+
109
+ **Splits.** Default scene-level 70 / 15 / 15 split via `sha256(new_scene_id) % 100`. See `blender_indoor/metadata/splits.json`. The downstream panoramic-depth experiment (paper §4.10) uses a separate 94-scene Blender-indoor subset under its own scene-level split (84 / 10 / 10 = 3,400 / 362 / 423 frames).
110
+
111
+ ### Collection
112
+
113
+ Indoor data is produced by the CM-EVS pipeline (asset loading, coordinate normalization, candidate generation, 26-direction geometric-validity filtering, conflict-aware greedy selection, 2048×1024 high-resolution Cycles ERP rendering, export under the unified schema). Outdoor data (TartanGround, OB3D) is re-encoded into the unified schema; the curator does **not** run on outdoor sources in v1.0. HM3D and ScanNet++ frames are not redistributed: the release ships adapter regeneration scripts that produce matched frames locally after the user accepts upstream license terms. No new human-subject data is collected.
114
+
115
+ ### Preprocessing
116
+
117
+ Coordinate normalization to right-handed `+X`-right `+Y`-up `+Z`-forward world frame with the OpenCV-style camera frame; pose stored as scalar-first `q_wc = [w, x, y, z]` plus position relative to the scene's first selected frame. AABB computation; source-specific candidate generation; 26-direction geometric-validity filter. Cubemap-to-ERP re-encoding at native resolution for outdoor sources; optional exposure adjustment for Blender; output schema conversion. Raw upstream 3D assets are not redistributed unless upstream licenses allow.
118
+
119
+ ### Uses
120
+
121
+ **Recommended:** panoramic depth estimation, ERP novel-view synthesis, data-centric viewpoint policy comparison, view-planning research, panoramic Gaussian-splatting reconstruction, panoramic world-model pretraining.
122
+
123
+ **Avoid:** identity-sensitive inference, safety-critical deployment, claims about private indoor spaces, treating synthetic-only results as real-world evidence without further validation.
124
+
125
+ ### Distribution
126
+
127
+ Blender indoor frames (CC-BY 4.0), curator code (MIT), documentation (CC-BY 4.0), Datasheet, and Croissant metadata are released here. The four restricted sources ship metadata + regeneration scripts only.
128
+
129
+ ### Maintenance
130
+
131
+ Versioned releases on a 6-month cadence. Errata are tracked via the project repository; checksum manifests are refreshed at every release; regeneration scripts are updated when upstream APIs, file layouts, or access terms change.
132
+
133
+ ## Citation
134
+
135
+ ```bibtex
136
+ @inproceedings{cmevs2026,
137
+ title={{CM-EVS}: A Coverage-Curated Panoramic {RGB-D} Dataset for Indoor Scene Understanding},
138
+ author={Anonymous Author(s)},
139
+ booktitle={NeurIPS 2026 Datasets and Benchmarks Track (under review)},
140
+ year={2026}
141
+ }
142
+ ```
143
+
144
+ ## Verifying integrity
145
+
146
+ ```bash
147
+ # top-level files + adapter packages + code + metadata
148
+ shasum -a 256 -c SHA256SUMS
149
+
150
+ # Blender indoor frames (39,896 entries: 13,631 panorama + 12,634 depth + 13,631 pose)
151
+ cd blender_indoor && shasum -a 256 -c SHA256SUMS
152
+ ```
153
+
154
+ ## License
155
+
156
+ See `LICENSE.md` for the per-component license matrix.
SHA256SUMS ADDED
@@ -0,0 +1,88 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ 335453649489fd3fa08a4296e38ba8a86dabb8455501ad9f78ef2b08a4092bd6 CHANGELOG.md
2
+ 6c00f7c8cd699b2e706058cf03f8a12866fb588abebf80a29ba21ff4b4407ac5 LICENSE.md
3
+ a04a8e6d4ce3bf5c9dab3aa27c7e050e08247106dce5b5e7637e5d23ede533c4 README.md
4
+ 296be8845dcbe9d09f01762726d5618c62e2adebd530bd1286b9eb342d91ecb3 TODO.md
5
+ 2c66395c6714c6664039a03344cb795c9216258b957d16990f020623883ebe48 adapters/README.md
6
+ 979bb0b0eba729b79f2f1b1fa51095d8a58ca6d363abc6dc7e678c8517d90c61 adapters/hm3d/README.md
7
+ 93ddb9458d7caaa9898df553a1a9f756b5fca0cdc6514edff226b13176c0577e adapters/hm3d/config.yaml
8
+ 65eba96c4175d2f8cef275b306169463ad138f2d329c7aed70c447d89062764d adapters/hm3d/metadata/source_manifest.json
9
+ 1008e53f357b0cb3126139b682ceede7d329b6e3dfa2f178b4cf62d7eda591f9 adapters/hm3d/pipeline.py
10
+ 0dbec1b25b605ea7a92771ee50da7274aef1214430f0176eec2d4c05ccadb37b adapters/ob3d/README.md
11
+ fa1c89831631f09015ac87bd0d409dac8a1c38d88425defbdc33b106f7dbffc1 adapters/ob3d/config.yaml
12
+ 777d9f30d901755dc4176cf1477e4d3bd5f39f835db38c7798915f6907036dac adapters/ob3d/metadata/source_manifest.json
13
+ f4645cb6e5448e51b88f7b7f4d3795f2c2c1356e906d64e99725dad922bd0970 adapters/ob3d/reencoding_script.md
14
+ 137f008232551fb16503fe1785c97e774c5a566db74b07bc8811423714437986 adapters/scannetpp/README.md
15
+ 00cd245e4e590b8f7f649cfa87170099d758c0f166970755270b2f752a478666 adapters/scannetpp/config.yaml
16
+ 2097e0ab11ce36b97dc7f52deba9e1a8ee26ac3556f804934905559a0000b692 adapters/scannetpp/metadata/source_manifest.json
17
+ 8c03c3f667f9ee1466d1c183359bf9a4d182473675d07515f8dfcbecfca39928 adapters/scannetpp/pipeline.py
18
+ f7d2598f886e92d8d197d54fbc5daffa6851cfa00b09a7746be07ca3b1ae7e5f adapters/tartanground/README.md
19
+ 4685882bc25d76b6cf1d1edbc142687f1d3165864a50267cfc245340bac8c948 adapters/tartanground/config.yaml
20
+ 7d7f2208aac42acfeee05dc6e0683b1a9f81aabbc66c58c7f1cb6ad0547b1aa5 adapters/tartanground/metadata/source_manifest.json
21
+ 8dc66b506fdd7f5a2f093e32ed90c9c203b5884c301f9be2afe83831e2862f8a adapters/tartanground/reencoding_script.md
22
+ cce8650483e0e6b80ff5872ce954d1e4db639a6a6bdfb0dacfe9fa003818aafc blender_indoor/README.md
23
+ 8a61d8ea13c49e66394810776f982ae5918e43ecd9c5482796801a1355a551bb blender_indoor/metadata/frame_id_mapping.csv
24
+ 6d851b67947c8e9d2992b4fbb935db4b6cebab7ce917b0e03242d8f6e3e94c4d blender_indoor/metadata/frame_manifest.csv
25
+ 58f2ee4949e5def251babc54f39bf9ee170d482a116d0a337993726f7b565c92 blender_indoor/metadata/scene_id_mapping.csv
26
+ c44fabb3932d6067704825d9af59ccf633c5129bffad9fd8a30ed4720a726ae1 blender_indoor/metadata/source_manifest.json
27
+ 072493c9e533554c0faafb1d3ba766365152f6c5084e2837d29f4d5279c76ab6 blender_indoor/metadata/splits.json
28
+ 2c14d7ac4ef207357073eabef1bc7f65853ab248237550a5542a59ba677f8ade code/LICENSE
29
+ b8bba6d5adc75decd73c4da0723b60c2678bb94985ba07085b08dc391faa0e35 code/README.md
30
+ efb670c7a9eef10060a1d50f36be3670402e20716f1c01d7ed70964ae1879e14 code/README_REPRODUCE.md
31
+ a195a9cdf86c7c2d23d5259fa0cb3cc75dd327411be3b3f5d78f227f36ad4a8c code/configs/base_erpt.yaml
32
+ 0086890995745e230a23ef766795af44e5cd633f792d9e9386594d6b1a339586 code/configs/blender_indoor.yaml
33
+ 3147f7c85a712e6f02f17330640ecb8c6bda0ff5b9994f22e90f95a53633adfb code/configs/blender_outdoor.yaml
34
+ 4e03f04feaee0a3d0d355e6a260c93d0d0ecd44e3b58b7ee6c23a710fcefcfd9 code/configs/default.yaml
35
+ 93ddb9458d7caaa9898df553a1a9f756b5fca0cdc6514edff226b13176c0577e code/configs/hm3d.yaml
36
+ 00cd245e4e590b8f7f649cfa87170099d758c0f166970755270b2f752a478666 code/configs/scannetpp.yaml
37
+ f41e12d62f7dc5f0fa6259d8d35dfc8ea20f2fdd94e1bed3dcbbe07ae856dd48 code/configs/tiny.yaml
38
+ 9b3d00ec613ce18b4eeadbc9af0053251e074c61e8937062d79442fe9282b48f code/core/__init__.py
39
+ 3fad91fe28ebd11a98178179622a2cee9ad2dfb0f057ae62eae5f3821f0e985e code/core/coordinate.py
40
+ 06b214daacd64b0de9747abc2d50d0318ac7ce122f315d48c5e05d891a78d221 code/core/depth_estimation.py
41
+ 31fbacffa8b2b0aa40eddfea6d7ba53c28137d9ee6ad91298771f66c98e8cf73 code/core/depth_fusion.py
42
+ ee596d36829271f164a4e1d6a297aaa42ef8eaaa0339d3b4b14f3b9089b084c7 code/core/erp_projection.py
43
+ f714d3d887b142cb63f0c1fc23dde0949b1e179330964edb6216bc06d5d318ab code/core/erp_warp.py
44
+ a8a1ba38ffde69fd0c07f653fc388dc9fc53eb5aa2b95a3ed58d54848714e03e code/core/tangent_extraction.py
45
+ 21e7c6c68fd31d5c63f6cb9f949e38adf78a5660f83650481afccc418b9390ab code/data/README.md
46
+ e5261ad1221380fad1174aeb931355679f419f8bfa8266f3bff06d9b2b917f75 code/dataset_metadata/croissant.json
47
+ c9e7127fc7c6de554516ee219e8aeaa2fca1b00951099d973c7e8af8db32ea95 code/environment.yml
48
+ 4b6766691ae074a066ed06919cc372a2849b435e372e6a24849154d0b09c1195 code/examples/metadata/candidates.jsonl
49
+ 71c290335857fd7b4a53e507bc94fa6e6c20d1fbdc768fed0e9de20e11229e65 code/examples/tiny_blender_scene/README.md
50
+ ae204fa937a7a427e8bc06fe204ecc16e26eba191a0187b98e6ed20e0a9d7ace code/metadata_examples/candidates.schema.json
51
+ 6839cf7fd0bf08de9006ae76b007843fd6ceb997a83a7e632b0b051f903ce789 code/metadata_examples/per_step_log.schema.json
52
+ 23832a8e7d3b0b7e52d0beb7d71f45c210b558d336f7e48bf6b81fbb3a1d8388 code/metadata_examples/selected_viewpoints.schema.json
53
+ bddf800be3a0e5046fdf8a5435733d19199e16d63df25a2ba62de9c1c50f46ba code/pipelines/get_blend_bounds.py
54
+ 4de927c2825256599466766e323d3530eb10b55ea9b618953660bbff9b8ee4d1 code/pipelines/render_erp_blender.py
55
+ 7313dc7cd2fb4a03b9fdfe19503511ac7551a2c231a2e83f66b02fcbdcd55798 code/pipelines/run_blend_pipeline.py
56
+ eff64bfb9b1a5d8fa4add9fa7e006b750c3c029220c9ea3cb2e39f735c92a9a6 code/pipelines/run_full_pipeline.py
57
+ 1008e53f357b0cb3126139b682ceede7d329b6e3dfa2f178b4cf62d7eda591f9 code/pipelines/run_hm3d_pipeline.py
58
+ 0e72c1081ff0f541a552731d7e86eda3380f652e8866f6bb612f64ba8c57cd5b code/pipelines/run_pipeline.py
59
+ 8c03c3f667f9ee1466d1c183359bf9a4d182473675d07515f8dfcbecfca39928 code/pipelines/run_ply_pipeline.py
60
+ b853a2be65e05a38435cadda54c29926a5c8d6c9a96b68752478a24bda42ca76 code/requirements.txt
61
+ 72dbcd63d46db055eaf12d5afc7a5bdd402833ef03c886db570d47fde476efdf code/results/README.md
62
+ dd7ed0dc4e17143b0cb2be9269035cc67a6f0d2292992426d4362091143c14f3 code/scripts/_common.py
63
+ 3c41a31d1723ce8bcba2a619ee79ee986ddb51e368664c073b97359feda45b48 code/scripts/audit_quality.py
64
+ d6fbe64e1cf56d7e3d487e108207e47797cbc1e17b2063786b965674e4d831fa code/scripts/build_candidates.py
65
+ 9c7cff2bbfaaf0bb52d8ed9b604f3a7167885d1e514a3ab6469f3909f5d1a7e5 code/scripts/check_anonymity.sh
66
+ d52befd9b56357de17dbe33ef840a352d6152695319a9446dc5c71bfca6d70f6 code/scripts/evaluate_coverage.py
67
+ bd2c6c8fb8869ca34608254c2719b9484a9817628e82e3802b0d4efd13d5c568 code/scripts/evaluate_oracle_gap.py
68
+ 21adb3f4cde65b77387873555f16df4a8b260bc0901bc555a2eab9b7db85930c code/scripts/render_selected.py
69
+ e9392972fb7937bc42c493cb18b96bba4f5bf2cad207e07bf30750083e9bd710 code/scripts/run_blender_indoor.sh
70
+ 54f6a5af30881ac32f867a8d22437c999f390871cb162319d79e77e2d96b1e4f code/scripts/run_tiny.sh
71
+ 00c330c04a8ca40e30251efccda7e716ae3a8876056a5688d34279c0fb02029f code/scripts/select_views.py
72
+ 90a20ddfd55c434dd9df4496dd757f00ccfd18f76c24affd6b3fe67e466df1a3 code/scripts/selection_metrics.py
73
+ 8ce9e1d8d99ab19b899eae3abfcd345cfb2405ede6541db97884526a3e8173c6 code/scripts/summarize_blender_indoor_run.py
74
+ a03153d20d38fb6805aaa980b659c1964d312f209605fbdbd692ef3b3db44232 code/scripts/summarize_quality_audit.py
75
+ e4cfbffc9ce620f47f977aa6a4cc78f546125ac33189948f5da8a41ac3bf5690 code/third_party/README.md
76
+ e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 code/tools/__init__.py
77
+ 043e8fc09641621a207543857f621195b9365e2da9ce9d8f6cfd6517cdcd99d9 code/tools/make_sha256sums.sh
78
+ 1f28cb01c320379ce4138842f848fdcae2db224b805942d0e17c20d132c74609 code/tools/navmesh_utils.py
79
+ 08dc49bc2f8bf272274625235f7a9eeec99f94bb3e011778731cc87f28157552 code/tools/semantic_utils.py
80
+ 80b87f28df042b2789fd650aec2bbf97a29b6d3a20bb2b13b7dba3c64ec8e06a code/tools/update_croissant_with_real_hashes.py
81
+ e5261ad1221380fad1174aeb931355679f419f8bfa8266f3bff06d9b2b917f75 croissant.json
82
+ 776469105fec88931d5d91239f98b31284e7e090beaf8a8bd7f4aa2e03728594 results/README.md
83
+ df494f4c0a6fc76d9180310286f839e6c4631c009b0244ea192eb552b186c50f results/audit_50_frames.csv
84
+ 04d0f1d19756fb279564a4d5ba0e571f2cab8518a50cce4860d292065bfa64c2 results/coverage_main.csv
85
+ 3815d5acdfb0b7a9aa5566d09820878580c5f93ac3aedfc689efff67c8f6d760 results/cross_source.csv
86
+ 37ada0e9beb0ca623452a745caf6032eb03d71507e900579b13d420d14bcd702 results/frame_quality.csv
87
+ 40a4f28a3208e8db3e85e38821bb171c6e9d6e073746dde85176a8576760196b results/lambda_sweep.csv
88
+ ae7fcb6f12fd22cc527242749809781929f10836bf4951cb9be16d0f5a5f0048 results/oracle_validation.csv
TODO.md ADDED
@@ -0,0 +1,83 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # TODO — before pushing this directory to Hugging Face
2
+
3
+ This is the list of items still in flight. Some require running the §5 evaluation experiments; others require human review (50-frame audit) or upstream license confirmation. The directory is **internally consistent and self-verifying** today; what's missing is filled-in experiment results and the actual Hugging Face push.
4
+
5
+ Estimated time-to-push: **~1–2 weeks** assuming §5 experiments are running in parallel.
6
+
7
+ ---
8
+
9
+ ## Blocking — must be done before push
10
+
11
+ - [ ] **Reconcile paper numbers vs. data drop.** Paper §4.3 Table 4 says `Blender indoor: 326 scenes / 11,583 frames`. v1.0 here stages **374 / 13,631** (round1+2 + round2 union, no de-dup). Three options:
12
+ - (a) Update paper to `374 / 13,631` and label this version "raw, pre-curator". → simplest.
13
+ - (b) Run the curator on the 374-scene set so the final selection lands at exactly 11,583 over 326 (matches paper). → requires §5 to converge first.
14
+ - (c) Keep paper as is and ship v1.0 alongside the curator-selected v1.1; explicitly document the relationship.
15
+ - [ ] **`croissant.json`: align numbers and fill real hashes.**
16
+ - Update `description` field: `11,583 ERP RGB-depth-pose frames over 326 Blender indoor scenes` → match whichever count is on the paper.
17
+ - Replace every `"sha256": "TODO_SHA256"` with the actual SHA-256 of the packaged tar (or per-file equivalent if uploading individual files via HF LFS).
18
+ - Replace every `https://anonymous.4open.science/r/cmevs-XXXX/...` `contentUrl` with the real Hugging Face dataset URL (resolved to LFS, e.g. `https://huggingface.co/datasets/<user>/cmevs-erp-eval/resolve/main/...`).
19
+ - Re-validate with `mlcroissant`: `python -c "from mlcroissant import Dataset; Dataset(jsonld='croissant.json')"`.
20
+ - [ ] **§5 experiment result CSVs.** Drop into `results/`:
21
+ - `coverage_main.csv` (§5.1 Random / Uniform / FPS / coverage-only / conflict-aware × K=8/16/32)
22
+ - `oracle_validation.csv` (§5.2 30-unit pre-render-all vs. warping oracle: gain corr, top-1 agreement, ε̄, GPU-h, speedup)
23
+ - `lambda_sweep.csv` (§5.3 λ ∈ {0, 0.05, 0.1, 0.2, 0.35, 0.5, 0.75, 1.0})
24
+ - `cross_source.csv` (§5.4 Blender / HM3D / ScanNet++ at K=30; ≥5 units per source for std/SE)
25
+ - `audit_50_frames.csv` (Appendix F.2 50-frame manual + vision-model-assisted audit)
26
+ - [ ] **`results/frame_quality.csv` (§4.8).** Run `code/scripts/audit_quality.py` on `blender_indoor/scenes/`; output one row per frame with `{frame_id, source, scene_id, invalid_depth_ratio, under_exposed_ratio, over_exposed_ratio, finite_depth_min, finite_depth_max, finite_depth_p50}`. Append per-source aggregates at the bottom (median invalid-depth ratio target ≈ 1.4% per the paper).
27
+
28
+ ---
29
+
30
+ ## Curator output (depends on §5 running)
31
+
32
+ - [ ] **Per-scene `meta.json`** under `blender_indoor/scenes/sence_indoor_NNNN/meta.json`. Re-states the world / camera coordinate convention and records the absolute first-frame center for each scene.
33
+ - [ ] **Per-scene `metadata/selected_viewpoints.json`** (curator-selected viewpoints + scores).
34
+ - [ ] **Per-scene `metadata/candidates.jsonl`** (full feasible candidate set + 26-direction validity flags).
35
+ - [ ] **Per-scene `metadata/per_step_log.jsonl`** (per-step `G_t`, `L_t`, `s_t`, runtime).
36
+ - [ ] **`blender_indoor/metadata/frame_manifest.csv`** — fill the curator-only columns: `viewpoint_score`, `coverage_gain`, `conflict_ratio`, `candidate_id`. Currently blank for v1.0.
37
+
38
+ ---
39
+
40
+ ## Adapters — config completion + license confirmation
41
+
42
+ - [ ] **`adapters/ob3d/config.yaml`** is a placeholder; populate from the real OB3D adapter parameters (cubemap face size, trajectory sampling interval, axis-conversion matrix). Source: paper §3.4 outdoor adapter description.
43
+ - [ ] **`adapters/tartanground/config.yaml`** same as above.
44
+ - [ ] **HM3D / ScanNet++ / TartanGround / OB3D upstream license check.** Default note in `LICENSE.md` is "per upstream"; before pushing, confirm in writing whether **scene-id metadata** (not frames) can be redistributed at all. If any source forbids redistributing scene ids, strip them from `adapters/<source>/metadata/source_manifest.json` and replace with a placeholder + recipe.
45
+
46
+ ---
47
+
48
+ ## Hugging Face push mechanics
49
+
50
+ - [ ] **Decide repository name** (suggested: `cmevs-erp-eval`) and **visibility** (public vs gated). Anonymous submission requires public read.
51
+ - [ ] **`.gitattributes`** with LFS rules:
52
+ ```
53
+ *.png filter=lfs diff=lfs merge=lfs -text
54
+ *.npy filter=lfs diff=lfs merge=lfs -text
55
+ *.tar filter=lfs diff=lfs merge=lfs -text
56
+ *.zip filter=lfs diff=lfs merge=lfs -text
57
+ ```
58
+ - [ ] **HF repo creation**: `huggingface-cli repo create datasets/<user>/cmevs-erp-eval --type dataset`.
59
+ - [ ] **First push**: `git lfs install && git clone … && rsync -av --exclude=.git /data/.../cmevs_hf_release/ <repo>/ && git add . && git commit && git push`.
60
+ - [ ] **Anonymous review**: ensure HF profile name is anonymized for the double-blind review window.
61
+ - [ ] **Smoke test the URL** in a private browser (no login) — confirm README renders, Croissant button appears, sample data downloads.
62
+
63
+ ---
64
+
65
+ ## Anonymity scan (before push)
66
+
67
+ - [ ] No absolute filesystem paths from a developer machine appear in any release file (run a recursive search for `/Users/`, `/home/<username>`, `/Volumes/`).
68
+ - [ ] No personal email addresses appear in any release file (recursive search for `@yahoo`, `@gmail`, `@anthropic`, `@<your-domain>`).
69
+ - [ ] No `.DS_Store`, `*.pyc`, `__pycache__/`, or `._*` AppleDouble artifacts remain (run `find ... -name '.DS_Store' -o -name '*.pyc' -o -name '._*'` → 0 results).
70
+ - [ ] All `pose_*.json` strip any author / system metadata accidentally embedded by Cycles.
71
+ - [ ] All `panorama_*.png` EXIF stripped (`exiftool -all= panorama_*.png` if needed).
72
+ - [ ] Any local file paths inside metadata JSON (e.g. `original_frame_path`) are rebased to anonymized labels (round identifiers like `round1+2` / `round2` are fine; full developer-machine absolute paths are not).
73
+
74
+ ---
75
+
76
+ ## Post-push synchronization
77
+
78
+ - [ ] OpenReview submission form:
79
+ - `Dataset URL`: HF repo URL
80
+ - `Croissant File`: upload the `croissant.json` independently (also kept here)
81
+ - `Code URL`: anonymous mirror of `code/` (separate Anonymous GitHub repo)
82
+ - [ ] `main.tex` §4.7 Table — replace `TODO:ANON_SAMPLE_URL` and `TODO:SHA256_MANIFEST` with the real HF URLs.
83
+ - [ ] `cmevs_anonymous_code_release/dataset_metadata/manifests_h100/README.md` — append a note: "stale post-renaming; superseded by `cmevs_hf_release/blender_indoor/SHA256SUMS`".
adapters/README.md ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Adapter packages — license-aware regeneration for restricted sources
2
+
3
+ The four sources here (HM3D, ScanNet++, OB3D, TartanGround) cannot be redistributed as ERP RGB-D frames under their upstream licenses. Instead, each adapter package contains:
4
+
5
+ 1. A `config.yaml` with all curator / re-encoding parameters used in the paper (resolution, grid spacing, fixed-budget K, thresholds, …).
6
+ 2. A `pipeline.py` (curator adapters) or `reencoding_script.md` (outdoor re-encoders) describing exactly which command to run and which input layout it expects.
7
+ 3. A `metadata/source_manifest.json` listing the upstream scene / scan / part IDs that the paper's `K=30` evaluation runs over.
8
+
9
+ Users that want to reproduce the per-source ERP frames acquire the upstream data themselves (after accepting upstream license terms) and run the adapter locally.
10
+
11
+ ## Per-source quick reference
12
+
13
+ | Source | License gate | Adapter type | Scene count |
14
+ | --- | --- | --- | --- |
15
+ | **HM3D** | Matterport / HM3D EULA | curator (NavMesh-based room proposal → CM-EVS greedy) | 401 rooms |
16
+ | **ScanNet++** | ScanNet++ ToS | curator (mesh / point-cloud modes) | 500 scans |
17
+ | **OB3D** | per upstream | re-encoding (cubemap → ERP, pose unification) | 24 instances (12 scenes × 2 viewpoints) |
18
+ | **TartanGround** | per upstream (typically CC-BY-NC-SA) | re-encoding (cubemap → ERP, pose unification) | 762 parts (~11 environments) |
19
+
20
+ ## Curator adapters (HM3D, ScanNet++)
21
+
22
+ These plug into the standard CM-EVS pipeline:
23
+
24
+ ```
25
+ scene asset → adapter (load + normalize + propose candidates) → curator greedy selection →
26
+ high-res Cycles ERP render → unified output schema
27
+ ```
28
+
29
+ The adapter handles three things specific to that source:
30
+
31
+ - **Asset loading** (HM3D: `.glb`; ScanNet++: `.ply` point cloud or mesh).
32
+ - **Candidate proposal** (HM3D: NavMesh / cluster / label-based; ScanNet++: mesh / point-cloud sampling).
33
+ - **Source-specific failure modes** (e.g. ScanNet++ point-cloud mode degrades surface tests to `AABB + splat Z-buffer`).
34
+
35
+ To run an adapter:
36
+
37
+ ```bash
38
+ cd ../code
39
+ python pipelines/run_hm3d_pipeline.py --config ../adapters/hm3d/config.yaml
40
+ # or
41
+ python pipelines/run_ply_pipeline.py --config ../adapters/scannetpp/config.yaml
42
+ ```
43
+
44
+ Both adapters write to `outputs/<source>/<scene_id>/{rgb,depth,pose,metadata}/...` under the same schema as `blender_indoor/scenes/`.
45
+
46
+ ## Re-encoding adapters (OB3D, TartanGround)
47
+
48
+ These do **not** run the curator. Their job is to take dense RGB-D-pose trajectories already shipped by the upstream source and re-express them in CM-EVS's unified ERP + world-to-camera pose convention:
49
+
50
+ - Cubemap → ERP at the source's native resolution.
51
+ - Pose re-expressed in right-handed `+Y`-up world frame with scalar-first `q_wc`.
52
+ - The full re-encoded trajectory is released — outdoor frames are **not** curator-selected subsets and therefore do not carry per-step provenance logs (`per_step_log.jsonl`).
53
+
54
+ The `reencoding_script.md` inside each package documents the exact command, expected upstream layout, and output schema.
55
+
56
+ ## Source-id metadata
57
+
58
+ `metadata/source_manifest.json` in each adapter package lists the upstream IDs that the paper's reported numbers are computed over. If you need to reproduce the **exact** numbers in §5.4 (cross-source) or §4.10 (downstream), use only these IDs.
59
+
60
+ > **Caveat**: depending on each upstream license, simply listing scene IDs may itself be restricted. Before redistributing or quoting these manifests verbatim, check the upstream's terms. See `../LICENSE.md`.
61
+
62
+ ## Anonymous review note
63
+
64
+ For NeurIPS double-blind review, no upstream credentials are required to inspect this directory: the adapters list IDs and parameters, but no upstream data ships here. To **execute** an adapter, the reviewer must independently obtain the upstream dataset.
adapters/hm3d/README.md ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # HM3D adapter — CM-EVS
2
+
3
+ This package regenerates the HM3D portion of CM-EVS (401 rooms; paper reports 14,475 frames after local regeneration). **No HM3D-derived RGB-D frames are redistributed here**; users must independently accept the [HM3D EULA](https://aihabitat.org/datasets/hm3d/) and obtain the source data.
4
+
5
+ ## Files
6
+
7
+ - `config.yaml` — curator parameters (input source, output root, resolution, grid spacing, K, conflict weight λ, early-stop thresholds, etc.). Same values as used in the paper.
8
+ - `pipeline.py` — adapter entry point (CM-EVS curator + HM3D-specific NavMesh / cluster / label-based room proposal).
9
+ - `metadata/source_manifest.json` — list of 401 HM3D scene IDs the paper's evaluation runs over.
10
+
11
+ ## Reproducing the paper's HM3D frames
12
+
13
+ 1. Obtain HM3D from <https://aihabitat.org/datasets/hm3d/> after accepting the EULA.
14
+ 2. Place HM3D `.glb` files under `data/hm3d/<scene_id>/<scene_id>.glb` (matching `config.yaml`'s `pipeline.input_dir`).
15
+ 3. Install the curator code from `../../code/`:
16
+ ```bash
17
+ conda env create -f ../../code/environment.yml
18
+ conda activate cmevs
19
+ ```
20
+ 4. Run the pipeline:
21
+ ```bash
22
+ cd ../../code
23
+ python pipelines/run_hm3d_pipeline.py --config ../adapters/hm3d/config.yaml
24
+ ```
25
+ 5. Outputs land in `outputs/hm3d/<scene_id>/{rgb, depth, pose, metadata}/...` under the unified CM-EVS schema (see `../../blender_indoor/README.md` for the schema).
26
+
27
+ The 401-room evaluation set is determined by `metadata/source_manifest.json`; the paper's reported HM3D numbers (§4.3 Table 4 and §5.4) are reproduced by running this exact set with the shipped config.
28
+
29
+ ## What the adapter does
30
+
31
+ HM3D scenes contain multiple rooms in a single mesh, which would unfairly weight the curator toward whichever room dominates the AABB. This adapter solves it by:
32
+
33
+ 1. **Space-unit proposal** (before the standard Phase 1): NavMesh / cluster / room-label segmentation of the HM3D scene into per-room "space units"; each unit is curated independently.
34
+ 2. **Per-room Gini reporting** for transparency on frame allocation across rooms.
35
+ 3. **Standard Phase 1–2** (candidate grid + 26-direction filter + conflict-aware greedy) is then applied per space unit.
36
+
37
+ See paper §3.4 (Table 2 row "HM3D") and `pipeline.py` for details.
38
+
39
+ ## License
40
+
41
+ - This adapter code: **MIT** (see top-level `LICENSE.md`).
42
+ - HM3D-derived metadata (scene IDs, candidate metadata): bound by the **HM3D EULA**.
43
+ - Frames you produce by running this adapter on HM3D source data: bound by the HM3D EULA. The MIT license on the adapter does **not** override upstream terms for those frames.
adapters/hm3d/config.yaml ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ experiment:
2
+ source: hm3d
3
+ input_kind: glb
4
+
5
+ pipeline:
6
+ blender: /path/to/blender
7
+ input_dir: data/hm3d
8
+ output_root: outputs/hm3d
9
+ num_frames: 30
10
+ resolution: "2048,1024"
11
+ grid_spacing: 0.5
12
+ camera_height: null
13
+ min_frames: 5
14
+ stop_gain: 0.08
15
+ stop_score: -0.3
16
+ stop_delta: 0.08
17
+
adapters/hm3d/metadata/source_manifest.json ADDED
@@ -0,0 +1,412 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "source": "hm3d",
3
+ "label": "HM3D",
4
+ "description": "401 HM3D rooms used by the CM-EVS curator. Each entry maps to a NavMesh / cluster / label-derived space-unit.",
5
+ "license": "MIT (code) + Matterport / HM3D EULA (metadata)",
6
+ "release_policy": "no derived RGB-D frames redistributed; users regenerate locally",
7
+ "id_field": "room_id",
8
+ "id_count": 401,
9
+ "ids": [
10
+ "00000-kfPV7w3FaU5+space_01",
11
+ "00000-kfPV7w3FaU5+space_04",
12
+ "00000-kfPV7w3FaU5+space_05",
13
+ "00000-kfPV7w3FaU5+space_10",
14
+ "00000-kfPV7w3FaU5+space_12",
15
+ "00001-UVdNNRcVyV1+space_12",
16
+ "00001-UVdNNRcVyV1+space_17",
17
+ "00001-UVdNNRcVyV1+space_19",
18
+ "00001-UVdNNRcVyV1+space_24",
19
+ "00001-UVdNNRcVyV1+space_28",
20
+ "00001-UVdNNRcVyV1+space_36",
21
+ "00001-UVdNNRcVyV1+space_38",
22
+ "00003-NtVbfPCkBFy+space_01",
23
+ "00003-NtVbfPCkBFy+space_02",
24
+ "00003-NtVbfPCkBFy+space_18",
25
+ "00003-NtVbfPCkBFy+space_29",
26
+ "00003-NtVbfPCkBFy+space_35",
27
+ "00003-NtVbfPCkBFy+space_41",
28
+ "00003-NtVbfPCkBFy+space_42",
29
+ "00003-NtVbfPCkBFy+space_53",
30
+ "00003-NtVbfPCkBFy+space_58",
31
+ "00003-NtVbfPCkBFy+space_59",
32
+ "00004-VqCaAuuoeWk+space_00",
33
+ "00004-VqCaAuuoeWk+space_01",
34
+ "00004-VqCaAuuoeWk+space_12",
35
+ "00004-VqCaAuuoeWk+space_15",
36
+ "00006-HkseAnWCgqk+space_03",
37
+ "00006-HkseAnWCgqk+space_06",
38
+ "00006-HkseAnWCgqk+space_07",
39
+ "00006-HkseAnWCgqk+space_12",
40
+ "00006-HkseAnWCgqk+space_13",
41
+ "00006-HkseAnWCgqk+space_18",
42
+ "00007-UQuchpekHRJ+space_05",
43
+ "00007-UQuchpekHRJ+space_08",
44
+ "00007-UQuchpekHRJ+space_09",
45
+ "00007-UQuchpekHRJ+space_11",
46
+ "00008-VYnUX657cVo+space_00",
47
+ "00008-VYnUX657cVo+space_02",
48
+ "00008-VYnUX657cVo+space_05",
49
+ "00008-VYnUX657cVo+space_08",
50
+ "00008-VYnUX657cVo+space_09",
51
+ "00008-VYnUX657cVo+space_12",
52
+ "00008-VYnUX657cVo+space_28",
53
+ "00008-VYnUX657cVo+space_31",
54
+ "00008-VYnUX657cVo+space_32",
55
+ "00008-VYnUX657cVo+space_34",
56
+ "00008-VYnUX657cVo+space_39",
57
+ "00008-VYnUX657cVo+space_40",
58
+ "00008-VYnUX657cVo+space_41",
59
+ "00008-VYnUX657cVo+space_42",
60
+ "00009-vLpv2VX547B+space_08",
61
+ "00009-vLpv2VX547B+space_10",
62
+ "00009-vLpv2VX547B+space_11",
63
+ "00009-vLpv2VX547B+space_14",
64
+ "00009-vLpv2VX547B+space_18",
65
+ "00009-vLpv2VX547B+space_21",
66
+ "00009-vLpv2VX547B+space_26",
67
+ "00009-vLpv2VX547B+space_28",
68
+ "00010-DBjEcHFg4oq+space_00",
69
+ "00011-1W61QJVDBqe+space_03",
70
+ "00011-1W61QJVDBqe+space_05",
71
+ "00011-1W61QJVDBqe+space_06",
72
+ "00011-1W61QJVDBqe+space_07",
73
+ "00011-1W61QJVDBqe+space_11",
74
+ "00011-1W61QJVDBqe+space_12",
75
+ "00011-1W61QJVDBqe+space_13",
76
+ "00011-1W61QJVDBqe+space_26",
77
+ "00011-1W61QJVDBqe+space_27",
78
+ "00011-1W61QJVDBqe+space_29",
79
+ "00011-1W61QJVDBqe+space_30",
80
+ "00011-1W61QJVDBqe+space_31",
81
+ "00011-1W61QJVDBqe+space_32",
82
+ "00011-1W61QJVDBqe+space_33",
83
+ "00011-1W61QJVDBqe+space_34",
84
+ "00011-1W61QJVDBqe+space_36",
85
+ "00011-1W61QJVDBqe+space_37",
86
+ "00011-1W61QJVDBqe+space_38",
87
+ "00011-1W61QJVDBqe+space_42",
88
+ "00011-1W61QJVDBqe+space_43",
89
+ "00011-1W61QJVDBqe+space_44",
90
+ "00011-1W61QJVDBqe+space_45",
91
+ "00011-1W61QJVDBqe+space_46",
92
+ "00012-kDgLKdMd5X8+space_03",
93
+ "00012-kDgLKdMd5X8+space_09",
94
+ "00012-kDgLKdMd5X8+space_25",
95
+ "00012-kDgLKdMd5X8+space_28",
96
+ "00013-sfbj7jspYWj+space_05",
97
+ "00013-sfbj7jspYWj+space_06",
98
+ "00013-sfbj7jspYWj+space_13",
99
+ "00013-sfbj7jspYWj+space_14",
100
+ "00013-sfbj7jspYWj+space_15",
101
+ "00013-sfbj7jspYWj+space_16",
102
+ "00013-sfbj7jspYWj+space_17",
103
+ "00014-nYYcLpSzihC+space_03",
104
+ "00014-nYYcLpSzihC+space_09",
105
+ "00014-nYYcLpSzihC+space_10",
106
+ "00014-nYYcLpSzihC+space_11",
107
+ "00014-nYYcLpSzihC+space_29",
108
+ "00014-nYYcLpSzihC+space_30",
109
+ "00014-nYYcLpSzihC+space_31",
110
+ "00014-nYYcLpSzihC+space_32",
111
+ "00014-nYYcLpSzihC+space_33",
112
+ "00014-nYYcLpSzihC+space_34",
113
+ "00014-nYYcLpSzihC+space_35",
114
+ "00014-nYYcLpSzihC+space_36",
115
+ "00014-nYYcLpSzihC+space_37",
116
+ "00014-nYYcLpSzihC+space_40",
117
+ "00014-nYYcLpSzihC+space_41",
118
+ "00014-nYYcLpSzihC+space_70",
119
+ "00014-nYYcLpSzihC+space_71",
120
+ "00014-nYYcLpSzihC+space_72",
121
+ "00014-nYYcLpSzihC+space_73",
122
+ "00015-LPwS1aEGXBb+space_00",
123
+ "00015-LPwS1aEGXBb+space_01",
124
+ "00015-LPwS1aEGXBb+space_05",
125
+ "00015-LPwS1aEGXBb+space_16",
126
+ "00015-LPwS1aEGXBb+space_17",
127
+ "00015-LPwS1aEGXBb+space_27",
128
+ "00015-LPwS1aEGXBb+space_30",
129
+ "00015-LPwS1aEGXBb+space_31",
130
+ "00015-LPwS1aEGXBb+space_32",
131
+ "00015-LPwS1aEGXBb+space_33",
132
+ "00015-LPwS1aEGXBb+space_34",
133
+ "00015-LPwS1aEGXBb+space_36",
134
+ "00015-LPwS1aEGXBb+space_37",
135
+ "00015-LPwS1aEGXBb+space_38",
136
+ "00015-LPwS1aEGXBb+space_39",
137
+ "00015-LPwS1aEGXBb+space_43",
138
+ "00016-qk9eeNeR4vw+space_09",
139
+ "00016-qk9eeNeR4vw+space_23",
140
+ "00016-qk9eeNeR4vw+space_25",
141
+ "00017-oEPjPNSPmzL+space_03",
142
+ "00017-oEPjPNSPmzL+space_07",
143
+ "00018-as8Y8AYx6yW+space_00",
144
+ "00018-as8Y8AYx6yW+space_10",
145
+ "00018-as8Y8AYx6yW+space_11",
146
+ "00018-as8Y8AYx6yW+space_12",
147
+ "00018-as8Y8AYx6yW+space_13",
148
+ "00018-as8Y8AYx6yW+space_14",
149
+ "00018-as8Y8AYx6yW+space_17",
150
+ "00018-as8Y8AYx6yW+space_18",
151
+ "00018-as8Y8AYx6yW+space_20",
152
+ "00018-as8Y8AYx6yW+space_21",
153
+ "00018-as8Y8AYx6yW+space_23",
154
+ "00018-as8Y8AYx6yW+space_24",
155
+ "00018-as8Y8AYx6yW+space_25",
156
+ "00018-as8Y8AYx6yW+space_26",
157
+ "00018-as8Y8AYx6yW+space_27",
158
+ "00018-as8Y8AYx6yW+space_28",
159
+ "00018-as8Y8AYx6yW+space_29",
160
+ "00018-as8Y8AYx6yW+space_34",
161
+ "00018-as8Y8AYx6yW+space_35",
162
+ "00018-as8Y8AYx6yW+space_36",
163
+ "00018-as8Y8AYx6yW+space_38",
164
+ "00018-as8Y8AYx6yW+space_46",
165
+ "00018-as8Y8AYx6yW+space_48",
166
+ "00018-as8Y8AYx6yW+space_51",
167
+ "00018-as8Y8AYx6yW+space_53",
168
+ "00018-as8Y8AYx6yW+space_55",
169
+ "00018-as8Y8AYx6yW+space_56",
170
+ "00018-as8Y8AYx6yW+space_57",
171
+ "00018-as8Y8AYx6yW+space_58",
172
+ "00019-AfKhsVmG8L4+space_02",
173
+ "00019-AfKhsVmG8L4+space_03",
174
+ "00019-AfKhsVmG8L4+space_05",
175
+ "00019-AfKhsVmG8L4+space_11",
176
+ "00019-AfKhsVmG8L4+space_12",
177
+ "00019-AfKhsVmG8L4+space_14",
178
+ "00020-XYyR54sxe6b+space_00",
179
+ "00020-XYyR54sxe6b+space_02",
180
+ "00020-XYyR54sxe6b+space_03",
181
+ "00021-yQESfVcg18k+space_01",
182
+ "00021-yQESfVcg18k+space_02",
183
+ "00021-yQESfVcg18k+space_07",
184
+ "00021-yQESfVcg18k+space_09",
185
+ "00021-yQESfVcg18k+space_10",
186
+ "00021-yQESfVcg18k+space_21",
187
+ "00021-yQESfVcg18k+space_25",
188
+ "00021-yQESfVcg18k+space_26",
189
+ "00021-yQESfVcg18k+space_27",
190
+ "00021-yQESfVcg18k+space_30",
191
+ "00021-yQESfVcg18k+space_31",
192
+ "00021-yQESfVcg18k+space_32",
193
+ "00021-yQESfVcg18k+space_36",
194
+ "00021-yQESfVcg18k+space_38",
195
+ "00021-yQESfVcg18k+space_39",
196
+ "00021-yQESfVcg18k+space_43",
197
+ "00021-yQESfVcg18k+space_44",
198
+ "00021-yQESfVcg18k+space_50",
199
+ "00021-yQESfVcg18k+space_53",
200
+ "00021-yQESfVcg18k+space_55",
201
+ "00022-gmuS7Wgsbrx+space_02",
202
+ "00022-gmuS7Wgsbrx+space_06",
203
+ "00022-gmuS7Wgsbrx+space_07",
204
+ "00022-gmuS7Wgsbrx+space_08",
205
+ "00022-gmuS7Wgsbrx+space_23",
206
+ "00022-gmuS7Wgsbrx+space_24",
207
+ "00022-gmuS7Wgsbrx+space_25",
208
+ "00022-gmuS7Wgsbrx+space_26",
209
+ "00022-gmuS7Wgsbrx+space_27",
210
+ "00022-gmuS7Wgsbrx+space_29",
211
+ "00022-gmuS7Wgsbrx+space_30",
212
+ "00022-gmuS7Wgsbrx+space_37",
213
+ "00022-gmuS7Wgsbrx+space_64",
214
+ "00022-gmuS7Wgsbrx+space_65",
215
+ "00024-XNoaAZwsWKk+space_09",
216
+ "00024-XNoaAZwsWKk+space_11",
217
+ "00024-XNoaAZwsWKk+space_12",
218
+ "00024-XNoaAZwsWKk+space_15",
219
+ "00025-ixTj1aTMup2+space_03",
220
+ "00025-ixTj1aTMup2+space_05",
221
+ "00025-ixTj1aTMup2+space_09",
222
+ "00025-ixTj1aTMup2+space_10",
223
+ "00025-ixTj1aTMup2+space_12",
224
+ "00025-ixTj1aTMup2+space_13",
225
+ "00025-ixTj1aTMup2+space_24",
226
+ "00025-ixTj1aTMup2+space_27",
227
+ "00025-ixTj1aTMup2+space_28",
228
+ "00025-ixTj1aTMup2+space_31",
229
+ "00026-tzaZQQmUVXZ+space_14",
230
+ "00027-cVppJowrUqs+space_00",
231
+ "00027-cVppJowrUqs+space_06",
232
+ "00027-cVppJowrUqs+space_07",
233
+ "00027-cVppJowrUqs+space_14",
234
+ "00028-xGnehmjiCSA+space_08",
235
+ "00028-xGnehmjiCSA+space_10",
236
+ "00028-xGnehmjiCSA+space_19",
237
+ "00029-4wCTuaUNWEd+space_06",
238
+ "00029-4wCTuaUNWEd+space_07",
239
+ "00029-4wCTuaUNWEd+space_18",
240
+ "00029-4wCTuaUNWEd+space_20",
241
+ "00029-4wCTuaUNWEd+space_25",
242
+ "00031-Wo6kuutE9i7+space_00",
243
+ "00031-Wo6kuutE9i7+space_01",
244
+ "00032-jTTGECZYKRA+space_09",
245
+ "00032-jTTGECZYKRA+space_11",
246
+ "00032-jTTGECZYKRA+space_15",
247
+ "00032-jTTGECZYKRA+space_17",
248
+ "00032-jTTGECZYKRA+space_19",
249
+ "00032-jTTGECZYKRA+space_20",
250
+ "00032-jTTGECZYKRA+space_21",
251
+ "00032-jTTGECZYKRA+space_22",
252
+ "00032-jTTGECZYKRA+space_23",
253
+ "00032-jTTGECZYKRA+space_24",
254
+ "00032-jTTGECZYKRA+space_26",
255
+ "00032-jTTGECZYKRA+space_27",
256
+ "00032-jTTGECZYKRA+space_36",
257
+ "00032-jTTGECZYKRA+space_37",
258
+ "00033-oPj9qMxrDEa+space_05",
259
+ "00033-oPj9qMxrDEa+space_06",
260
+ "00033-oPj9qMxrDEa+space_11",
261
+ "00033-oPj9qMxrDEa+space_12",
262
+ "00033-oPj9qMxrDEa+space_13",
263
+ "00034-6imZUJGRUq4+space_01",
264
+ "00034-6imZUJGRUq4+space_03",
265
+ "00034-6imZUJGRUq4+space_04",
266
+ "00034-6imZUJGRUq4+space_05",
267
+ "00034-6imZUJGRUq4+space_06",
268
+ "00034-6imZUJGRUq4+space_08",
269
+ "00034-6imZUJGRUq4+space_10",
270
+ "00034-6imZUJGRUq4+space_23",
271
+ "00034-6imZUJGRUq4+space_24",
272
+ "00034-6imZUJGRUq4+space_25",
273
+ "00034-6imZUJGRUq4+space_26",
274
+ "00034-6imZUJGRUq4+space_30",
275
+ "00034-6imZUJGRUq4+space_31",
276
+ "00034-6imZUJGRUq4+space_41",
277
+ "00035-3XYAD64HpDr+space_00",
278
+ "00035-3XYAD64HpDr+space_01",
279
+ "00035-3XYAD64HpDr+space_02",
280
+ "00035-3XYAD64HpDr+space_05",
281
+ "00035-3XYAD64HpDr+space_07",
282
+ "00035-3XYAD64HpDr+space_08",
283
+ "00035-3XYAD64HpDr+space_10",
284
+ "00035-3XYAD64HpDr+space_11",
285
+ "00036-41FNXLAZZgC+space_01",
286
+ "00036-41FNXLAZZgC+space_06",
287
+ "00036-41FNXLAZZgC+space_09",
288
+ "00037-oKFJo8jpzRW+space_02",
289
+ "00037-oKFJo8jpzRW+space_03",
290
+ "00037-oKFJo8jpzRW+space_20",
291
+ "00037-oKFJo8jpzRW+space_21",
292
+ "00038-aJg466zMSNt+space_01",
293
+ "00038-aJg466zMSNt+space_02",
294
+ "00038-aJg466zMSNt+space_05",
295
+ "00038-aJg466zMSNt+space_08",
296
+ "00038-aJg466zMSNt+space_11",
297
+ "00038-aJg466zMSNt+space_12",
298
+ "00038-aJg466zMSNt+space_21",
299
+ "00038-aJg466zMSNt+space_22",
300
+ "00039-ANmWrL7Kz7h+space_00",
301
+ "00039-ANmWrL7Kz7h+space_01",
302
+ "00039-ANmWrL7Kz7h+space_02",
303
+ "00039-ANmWrL7Kz7h+space_03",
304
+ "00039-ANmWrL7Kz7h+space_04",
305
+ "00039-ANmWrL7Kz7h+space_06",
306
+ "00039-ANmWrL7Kz7h+space_07",
307
+ "00039-ANmWrL7Kz7h+space_10",
308
+ "00039-ANmWrL7Kz7h+space_13",
309
+ "00039-ANmWrL7Kz7h+space_14",
310
+ "00039-ANmWrL7Kz7h+space_17",
311
+ "00039-ANmWrL7Kz7h+space_19",
312
+ "00039-ANmWrL7Kz7h+space_21",
313
+ "00039-ANmWrL7Kz7h+space_23",
314
+ "00039-ANmWrL7Kz7h+space_33",
315
+ "00039-ANmWrL7Kz7h+space_35",
316
+ "00039-ANmWrL7Kz7h+space_36",
317
+ "00040-ZB8o8rMmPdB+space_03",
318
+ "00040-ZB8o8rMmPdB+space_04",
319
+ "00040-ZB8o8rMmPdB+space_07",
320
+ "00040-ZB8o8rMmPdB+space_10",
321
+ "00040-ZB8o8rMmPdB+space_12",
322
+ "00040-ZB8o8rMmPdB+space_15",
323
+ "00040-ZB8o8rMmPdB+space_16",
324
+ "00040-ZB8o8rMmPdB+space_19",
325
+ "00040-ZB8o8rMmPdB+space_20",
326
+ "00040-ZB8o8rMmPdB+space_37",
327
+ "00040-ZB8o8rMmPdB+space_38",
328
+ "00040-ZB8o8rMmPdB+space_39",
329
+ "00040-ZB8o8rMmPdB+space_48",
330
+ "00041-QKfBMSSy7Hy+space_01",
331
+ "00041-QKfBMSSy7Hy+space_02",
332
+ "00041-QKfBMSSy7Hy+space_11",
333
+ "00041-QKfBMSSy7Hy+space_16",
334
+ "00041-QKfBMSSy7Hy+space_24",
335
+ "00041-QKfBMSSy7Hy+space_26",
336
+ "00041-QKfBMSSy7Hy+space_27",
337
+ "00041-QKfBMSSy7Hy+space_29",
338
+ "00042-qDjhFcNqFPi+space_00",
339
+ "00042-qDjhFcNqFPi+space_16",
340
+ "00043-Jfyvj3xn2aJ+space_04",
341
+ "00043-Jfyvj3xn2aJ+space_06",
342
+ "00046-UQ5EhY5wve1+space_23",
343
+ "00047-u9LiqMn6kA6+space_01",
344
+ "00047-u9LiqMn6kA6+space_28",
345
+ "00053-kAMF2R7PCqX+space_08",
346
+ "00053-kAMF2R7PCqX+space_13",
347
+ "00054-6BReaxZUoMg+space_10",
348
+ "00057-1UnKg1rAb8A+space_02",
349
+ "00057-1UnKg1rAb8A+space_08",
350
+ "00060-TgWKHxhJAng+space_07",
351
+ "00060-TgWKHxhJAng+space_11",
352
+ "00060-TgWKHxhJAng+space_14",
353
+ "00060-TgWKHxhJAng+space_45",
354
+ "00061-duthTPisf28+space_06",
355
+ "00061-duthTPisf28+space_21",
356
+ "00061-duthTPisf28+space_25",
357
+ "00063-KsD3yx9nZCv+space_06",
358
+ "00063-KsD3yx9nZCv+space_61",
359
+ "00064-gQgtJ9Stk5s+space_15",
360
+ "00064-gQgtJ9Stk5s+space_17",
361
+ "00065-kZhZfAhdnNN+space_00",
362
+ "00065-kZhZfAhdnNN+space_04",
363
+ "00065-kZhZfAhdnNN+space_09",
364
+ "00065-kZhZfAhdnNN+space_13",
365
+ "00066-nHHVbEyHX3t+space_03",
366
+ "00066-nHHVbEyHX3t+space_05",
367
+ "00067-osQy15y8EVT+space_03",
368
+ "00067-osQy15y8EVT+space_04",
369
+ "00067-osQy15y8EVT+space_07",
370
+ "00067-osQy15y8EVT+space_14",
371
+ "00067-osQy15y8EVT+space_15",
372
+ "00067-osQy15y8EVT+space_16",
373
+ "00068-812QqCky3T7+space_20",
374
+ "00069-Y8Y6ukxGMvn+space_08",
375
+ "00070-w7QyjJ3H9Bp+space_00",
376
+ "00070-w7QyjJ3H9Bp+space_07",
377
+ "00071-GCEb4nmNi7j+space_02",
378
+ "00071-GCEb4nmNi7j+space_04",
379
+ "00072-t8wCA6Qe8uT+space_06",
380
+ "00073-bCFcvb4zc3N+space_17",
381
+ "00073-bCFcvb4zc3N+space_33",
382
+ "00073-bCFcvb4zc3N+space_36",
383
+ "00074-kHvNo8x6Qoe+space_00",
384
+ "00074-kHvNo8x6Qoe+space_01",
385
+ "00074-kHvNo8x6Qoe+space_02",
386
+ "00074-kHvNo8x6Qoe+space_04",
387
+ "00074-kHvNo8x6Qoe+space_09",
388
+ "00074-kHvNo8x6Qoe+space_12",
389
+ "00074-kHvNo8x6Qoe+space_20",
390
+ "00074-kHvNo8x6Qoe+space_21",
391
+ "00074-kHvNo8x6Qoe+space_22",
392
+ "00074-kHvNo8x6Qoe+space_23",
393
+ "00074-kHvNo8x6Qoe+space_27",
394
+ "00075-u3zrj4Nojev+space_09",
395
+ "00075-u3zrj4Nojev+space_25",
396
+ "00075-u3zrj4Nojev+space_26",
397
+ "00076-fJ1GEE6PdHD+space_01",
398
+ "00076-fJ1GEE6PdHD+space_19",
399
+ "00077-z9VLaZqCsW5+space_07",
400
+ "00078-nJTPfwbAj4S+space_05",
401
+ "00078-nJTPfwbAj4S+space_06",
402
+ "00078-nJTPfwbAj4S+space_39",
403
+ "00079-2ihrkjrbHVf+space_06",
404
+ "00079-2ihrkjrbHVf+space_17",
405
+ "00081-5biL7VEkByM+space_02",
406
+ "00081-5biL7VEkByM+space_51",
407
+ "00082-y4YiUQwvWGH+space_17",
408
+ "00083-16tymPtM7uS+space_09",
409
+ "00088-z9w4aD7JsiQ+space_00",
410
+ "00090-C8VQQtzUoqV+space_00"
411
+ ]
412
+ }
adapters/hm3d/pipeline.py ADDED
The diff for this file is too large to render. See raw diff
 
adapters/ob3d/README.md ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # OB3D adapter — CM-EVS (re-encoding only)
2
+
3
+ OB3D is an outdoor source. Unlike HM3D / ScanNet++ (which run the full CM-EVS curator), OB3D ships dense pre-rendered cubemap trajectories upstream; this adapter's job is only to **re-encode** those trajectories into CM-EVS's unified ERP + world-to-camera pose schema.
4
+
5
+ The curator does **not** run on OB3D in v1.0; outdoor frames in the release are full re-encoded source trajectories, not curator-selected subsets, and they do not carry per-step provenance logs.
6
+
7
+ ## Files
8
+
9
+ - `config.yaml` — re-encoding parameters (input layout, output schema, axis-conversion matrix). Some fields are **placeholders** to be finalized; see `../../TODO.md`.
10
+ - `reencoding_script.md` — exact command + expected upstream layout + output schema.
11
+ - `metadata/source_manifest.json` — list of 24 instances (12 scenes × 2 viewpoints — Egocentric / Non-Egocentric) the paper's evaluation runs over.
12
+
13
+ ## Reproducing the paper's OB3D frames
14
+
15
+ 1. Obtain OB3D source data per its upstream license.
16
+ 2. Place under `data/ob3d/<scene_name>-{Egocentric,Non-Egocentric}/...` matching the layout in `reencoding_script.md`.
17
+ 3. Run the re-encoder:
18
+ ```bash
19
+ cd ../../code
20
+ python scripts/reencode_outdoor.py --source ob3d --config ../adapters/ob3d/config.yaml
21
+ ```
22
+ 4. Outputs land in `outputs/ob3d/<scene_name>-<viewpoint>/{rgb, depth, pose}/...` under the unified schema (without the `metadata/per_step_log.jsonl` since the curator does not run here).
23
+
24
+ ## What the re-encoding does
25
+
26
+ - **Cubemap → ERP** at the source's native resolution (1600×800 per paper §4.3 Table 4).
27
+ - **Pose unification**: rewrite original axis convention into the right-handed `+X`-right `+Y`-up `+Z`-forward world frame; pose stored as scalar-first `q_wc = [w, x, y, z]` plus position relative to scene first frame.
28
+ - **Egocentric vs Non-Egocentric** are kept as separate instances since their pose conventions differ; both are emitted under the same scene root.
29
+
30
+ See paper §3.4 (Table 2 row "OB3D") and §4.3 (Table 4 — outdoor / OB3D row).
31
+
32
+ ## License
33
+
34
+ - This adapter code: **MIT**.
35
+ - Frames you produce by re-encoding upstream OB3D data are bound by the **upstream OB3D license**. The MIT license on the adapter does **not** override upstream terms.
adapters/ob3d/config.yaml ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # OB3D outdoor re-encoding adapter — CM-EVS
2
+ #
3
+ # This is a placeholder reflecting paper §3.4 (Table 2 row "OB3D"). Concrete
4
+ # parameters (cubemap face size, axis-conversion matrix) are tracked in TODO.md
5
+ # and will be finalized before HF push.
6
+
7
+ experiment:
8
+ source: ob3d
9
+ input_kind: cubemap_dense_trajectory # OB3D upstream ships dense cubemap RGB-D-pose
10
+
11
+ reencoding:
12
+ # Where upstream OB3D files live (per scene_name × viewpoint).
13
+ # Layout is documented in reencoding_script.md.
14
+ input_dir: data/ob3d
15
+ output_root: outputs/ob3d
16
+
17
+ # Source cubemap face size — TODO: confirm against actual OB3D download.
18
+ cubemap_face_size: TODO # e.g. 800 (px per face)
19
+
20
+ # Final ERP resolution — paper §4.3 Table 4 lists OB3D at 1600×800.
21
+ erp_resolution: "1600,800"
22
+
23
+ # Pose handling.
24
+ pose_format: world_to_camera_quaternion # output convention
25
+ source_axis_convention: TODO # e.g. "y-down z-forward" — confirm from upstream
26
+ target_axis_convention: y-up_z-forward # CM-EVS world frame
27
+
28
+ # Depth handling.
29
+ depth_format: range # ERP range depth (radial), not perspective z
30
+ depth_unit: meters
31
+ invalid_marker: nan # NaN preferred; 0 also accepted
32
+
33
+ # Trajectory slicing (none for OB3D — full trajectory released per upstream).
34
+ trajectory_partition: false
35
+
36
+ # Per-scene metadata.
37
+ emit_meta_json: true # per-scene meta.json with coordinate convention
38
+ emit_per_step_log: false # curator does not run on outdoor in v1.0
39
+
40
+ # Source manifest (which scenes / viewpoints to re-encode):
41
+ # see metadata/source_manifest.json (24 instances = 12 scenes × 2 viewpoints)
adapters/ob3d/metadata/source_manifest.json ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "source": "ob3d",
3
+ "label": "OB3D",
4
+ "description": "12 outdoor scenes × 2 viewpoints (Egocentric / Non-Egocentric) = 24 instances. Re-encoding adapter only — no curator selection.",
5
+ "license": "MIT (code) + per upstream OB3D license (metadata + frames)",
6
+ "release_policy": "frames produced by re-encoding remain under upstream OB3D license",
7
+ "id_field": "instance_id",
8
+ "id_count": 24,
9
+ "ids": [
10
+ "archiviz-flat-Egocentric",
11
+ "archiviz-flat-Non-Egocentric",
12
+ "barbershop-Egocentric",
13
+ "barbershop-Non-Egocentric",
14
+ "bistro-Egocentric",
15
+ "bistro-Non-Egocentric",
16
+ "classroom-Egocentric",
17
+ "classroom-Non-Egocentric",
18
+ "emerald-square-Egocentric",
19
+ "emerald-square-Non-Egocentric",
20
+ "fisher-hut-Egocentric",
21
+ "fisher-hut-Non-Egocentric",
22
+ "lone-monk-Egocentric",
23
+ "lone-monk-Non-Egocentric",
24
+ "pavillion-Egocentric",
25
+ "pavillion-Non-Egocentric",
26
+ "restroom-Egocentric",
27
+ "restroom-Non-Egocentric",
28
+ "san-miguel-Egocentric",
29
+ "san-miguel-Non-Egocentric",
30
+ "sponza-Egocentric",
31
+ "sponza-Non-Egocentric",
32
+ "sun-temple-Egocentric",
33
+ "sun-temple-Non-Egocentric"
34
+ ]
35
+ }
adapters/ob3d/reencoding_script.md ADDED
@@ -0,0 +1,68 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # OB3D Re-encoding — exact procedure
2
+
3
+ ## Upstream layout (input)
4
+
5
+ OB3D ships dense cubemap RGB-D-pose trajectories. Place the upstream data under `data/ob3d/` matching this layout:
6
+
7
+ ```
8
+ data/ob3d/
9
+ ├── <scene_name>-Egocentric/
10
+ │ ├── cubemap/
11
+ │ │ ├── px/{frame_NNNN.png, frame_NNNN_depth.npy} # +X face
12
+ │ │ ├── nx/ # -X face
13
+ │ │ ├── py/, ny/, pz/, nz/ # remaining faces
14
+ │ ├── pose/
15
+ │ │ └── pose_NNNN.json # source pose convention
16
+ │ └── …
17
+ └── <scene_name>-Non-Egocentric/
18
+ └── (same structure)
19
+ ```
20
+
21
+ The exact upstream filenames depend on which OB3D distribution you use; the `pipeline.py` reads the layout from `config.yaml` so adjust `input_layout` there if needed.
22
+
23
+ ## Output schema (CM-EVS unified)
24
+
25
+ ```
26
+ outputs/ob3d/<scene_name>-<viewpoint>/
27
+ ├── meta.json # coordinate convention, first-frame center
28
+ ├── panorama_0000.png # ERP RGB, 1600×800
29
+ ├── panorama_0000_depth.npy # ERP range depth (m), float32
30
+ ├── pose_0000.json # { qwc: [w,x,y,z], position: [x,y,z], camera_type: "cubemap_reencoded" }
31
+ ├── panorama_0001.png
32
+ ├── panorama_0001_depth.npy
33
+ ├── pose_0001.json
34
+ └── …
35
+ ```
36
+
37
+ ## Run
38
+
39
+ ```bash
40
+ cd ../../code
41
+ python scripts/reencode_outdoor.py \
42
+ --source ob3d \
43
+ --config ../adapters/ob3d/config.yaml
44
+ ```
45
+
46
+ The script:
47
+
48
+ 1. Loads `config.yaml` → resolves cubemap face size, axis conversion, ERP target resolution.
49
+ 2. For each scene/viewpoint listed in `metadata/source_manifest.json`:
50
+ - Reads the 6 cubemap faces per frame, concatenates into ERP via standard cubemap → equirectangular projection.
51
+ - Re-projects depth: cubemap perspective `z` → ERP **range** depth (radial).
52
+ - Reads source pose, converts axis convention to CM-EVS world frame, expresses as `q_wc` + position.
53
+ - Writes the triple `panorama_NNNN.{png, _depth.npy}` and `pose_NNNN.json`.
54
+ 3. Emits per-scene `meta.json` re-stating the coordinate convention.
55
+
56
+ ## Verifying against paper
57
+
58
+ After running, compare with paper §4.3 Table 4:
59
+
60
+ - 12 scenes × 2 viewpoints = 24 instances ✓
61
+ - 200 frames each = 2,400 frames ✓
62
+ - Resolution 1600×800 ✓
63
+ - Median depth 3.88 m ✓ (sanity-check via your favorite stats script)
64
+
65
+ ## Caveats
66
+
67
+ - **No curator selection**. Paper §4.2 Table 3 row "Outdoor / OB3D" notes that all v1.0 outdoor frames are full re-encoded source trajectories, not curator-selected subsets. Therefore no `metadata/per_step_log.jsonl` is emitted.
68
+ - **License**: frames produced by this adapter remain under upstream OB3D license. Do not redistribute without checking upstream terms.
adapters/scannetpp/README.md ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # ScanNet++ adapter — CM-EVS
2
+
3
+ This package regenerates the ScanNet++ portion of CM-EVS (500 scans; paper reports 8,267 frames after local regeneration). **No ScanNet++-derived RGB-D frames are redistributed here**; users must independently accept the [ScanNet++ Terms of Service](https://kaldir.vc.in.tum.de/scannetpp/) and obtain the source data.
4
+
5
+ ## Files
6
+
7
+ - `config.yaml` — curator parameters (input source, output root, resolution, grid spacing, K, conflict weight λ, early-stop thresholds, point-size for splat mode, etc.).
8
+ - `pipeline.py` — adapter entry point (CM-EVS curator + ScanNet++-specific mesh / point-cloud proposal).
9
+ - `metadata/source_manifest.json` — list of 500 ScanNet++ scan IDs the paper's evaluation runs over.
10
+
11
+ ## Reproducing the paper's ScanNet++ frames
12
+
13
+ 1. Obtain ScanNet++ from <https://kaldir.vc.in.tum.de/scannetpp/> after accepting the ToS.
14
+ 2. Place per-scan files under `data/scannetpp/<scan_id>/<scan_id>.ply` (matching `config.yaml`'s `pipeline.input_dir`).
15
+ 3. Install the curator code:
16
+ ```bash
17
+ conda env create -f ../../code/environment.yml
18
+ conda activate cmevs
19
+ ```
20
+ 4. Run the pipeline:
21
+ ```bash
22
+ cd ../../code
23
+ python pipelines/run_ply_pipeline.py --config ../adapters/scannetpp/config.yaml
24
+ ```
25
+ 5. Outputs land in `outputs/scannetpp/<scan_id>/{rgb, depth, pose, metadata}/...` under the unified CM-EVS schema.
26
+
27
+ ## What the adapter does
28
+
29
+ ScanNet++ scans come as either textured **mesh** (preferred) or pure **point cloud**. This adapter handles both:
30
+
31
+ - **Mesh mode**: standard CM-EVS pipeline (raycast-based candidate generation, conflict-aware warping oracle).
32
+ - **Point-cloud mode**: degrades surface tests to `AABB + splat Z-buffer` because point clouds lack continuous surfaces. `point_size` in `config.yaml` controls the splat radius. This is a documented robustness limitation — see paper §3.4 Table 2 row "ScanNet++".
33
+
34
+ ## License
35
+
36
+ - This adapter code: **MIT**.
37
+ - ScanNet++-derived metadata (scan IDs): bound by the **ScanNet++ ToS**.
38
+ - Frames you produce: bound by the ScanNet++ ToS.
adapters/scannetpp/config.yaml ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ experiment:
2
+ source: scannetpp
3
+ input_kind: ply
4
+
5
+ pipeline:
6
+ input_dir: data/scannetpp
7
+ output_root: outputs/scannetpp
8
+ num_frames: 30
9
+ resolution: "2048,1024"
10
+ grid_spacing: 0.5
11
+ point_size: 2.0
12
+ z_up: true
13
+ min_frames: 5
14
+ stop_gain: 0.08
15
+ stop_score: -0.3
16
+ stop_delta: 0.08
17
+
adapters/scannetpp/metadata/source_manifest.json ADDED
@@ -0,0 +1,511 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "source": "scannetpp",
3
+ "label": "ScanNet++",
4
+ "description": "500 ScanNet++ scans (mesh / point-cloud) used by the CM-EVS curator.",
5
+ "license": "MIT (code) + ScanNet++ ToS (metadata)",
6
+ "release_policy": "no derived RGB-D frames redistributed; users regenerate locally",
7
+ "id_field": "scan_id",
8
+ "id_count": 500,
9
+ "ids": [
10
+ "scene021",
11
+ "scene022",
12
+ "scene023",
13
+ "scene025",
14
+ "scene026",
15
+ "scene027",
16
+ "scene031",
17
+ "scene032",
18
+ "scene035",
19
+ "scene036",
20
+ "scene037",
21
+ "scene038",
22
+ "scene039",
23
+ "scene041",
24
+ "scene042",
25
+ "scene043",
26
+ "scene045",
27
+ "scene046",
28
+ "scene048",
29
+ "scene049",
30
+ "scene050",
31
+ "scene051",
32
+ "scene054",
33
+ "scene058",
34
+ "scene061",
35
+ "scene065",
36
+ "scene066",
37
+ "scene071",
38
+ "scene072",
39
+ "scene073",
40
+ "scene076",
41
+ "scene077",
42
+ "scene078",
43
+ "scene079",
44
+ "scene081",
45
+ "scene082",
46
+ "scene083",
47
+ "scene084",
48
+ "scene085",
49
+ "scene087",
50
+ "scene093",
51
+ "scene094",
52
+ "scene097",
53
+ "scene098",
54
+ "scene099",
55
+ "scene100",
56
+ "scene102",
57
+ "scene103",
58
+ "scene104",
59
+ "scene105",
60
+ "scene108",
61
+ "scene109",
62
+ "scene112",
63
+ "scene113",
64
+ "scene116",
65
+ "scene117",
66
+ "scene118",
67
+ "scene119",
68
+ "scene120",
69
+ "scene121",
70
+ "scene123",
71
+ "scene124",
72
+ "scene125",
73
+ "scene126",
74
+ "scene128",
75
+ "scene129",
76
+ "scene131",
77
+ "scene133",
78
+ "scene134",
79
+ "scene135",
80
+ "scene137",
81
+ "scene138",
82
+ "scene140",
83
+ "scene141",
84
+ "scene142",
85
+ "scene143",
86
+ "scene145",
87
+ "scene149",
88
+ "scene150",
89
+ "scene151",
90
+ "scene153",
91
+ "scene155",
92
+ "scene158",
93
+ "scene159",
94
+ "scene160",
95
+ "scene163",
96
+ "scene168",
97
+ "scene169",
98
+ "scene171",
99
+ "scene173",
100
+ "scene174",
101
+ "scene175",
102
+ "scene177",
103
+ "scene180",
104
+ "scene183",
105
+ "scene184",
106
+ "scene185",
107
+ "scene186",
108
+ "scene187",
109
+ "scene189",
110
+ "scene190",
111
+ "scene191",
112
+ "scene192",
113
+ "scene194",
114
+ "scene195",
115
+ "scene196",
116
+ "scene199",
117
+ "scene201",
118
+ "scene202",
119
+ "scene203",
120
+ "scene205",
121
+ "scene211",
122
+ "scene212",
123
+ "scene213",
124
+ "scene214",
125
+ "scene217",
126
+ "scene220",
127
+ "scene221",
128
+ "scene222",
129
+ "scene224",
130
+ "scene226",
131
+ "scene228",
132
+ "scene230",
133
+ "scene232",
134
+ "scene235",
135
+ "scene237",
136
+ "scene238",
137
+ "scene239",
138
+ "scene240",
139
+ "scene241",
140
+ "scene242",
141
+ "scene243",
142
+ "scene245",
143
+ "scene246",
144
+ "scene251",
145
+ "scene252",
146
+ "scene253",
147
+ "scene254",
148
+ "scene255",
149
+ "scene258",
150
+ "scene260",
151
+ "scene264",
152
+ "scene265",
153
+ "scene266",
154
+ "scene267",
155
+ "scene270",
156
+ "scene271",
157
+ "scene272",
158
+ "scene273",
159
+ "scene277",
160
+ "scene278",
161
+ "scene279",
162
+ "scene281",
163
+ "scene286",
164
+ "scene287",
165
+ "scene289",
166
+ "scene291",
167
+ "scene292",
168
+ "scene293",
169
+ "scene297",
170
+ "scene302",
171
+ "scene305",
172
+ "scene306",
173
+ "scene308",
174
+ "scene312",
175
+ "scene313",
176
+ "scene315",
177
+ "scene317",
178
+ "scene321",
179
+ "scene323",
180
+ "scene324",
181
+ "scene326",
182
+ "scene327",
183
+ "scene331",
184
+ "scene332",
185
+ "scene334",
186
+ "scene336",
187
+ "scene337",
188
+ "scene339",
189
+ "scene340",
190
+ "scene341",
191
+ "scene342",
192
+ "scene343",
193
+ "scene344",
194
+ "scene346",
195
+ "scene354",
196
+ "scene355",
197
+ "scene357",
198
+ "scene358",
199
+ "scene359",
200
+ "scene360",
201
+ "scene361",
202
+ "scene362",
203
+ "scene363",
204
+ "scene365",
205
+ "scene366",
206
+ "scene367",
207
+ "scene369",
208
+ "scene371",
209
+ "scene372",
210
+ "scene374",
211
+ "scene375",
212
+ "scene376",
213
+ "scene377",
214
+ "scene378",
215
+ "scene379",
216
+ "scene380",
217
+ "scene381",
218
+ "scene382",
219
+ "scene386",
220
+ "scene388",
221
+ "scene390",
222
+ "scene392",
223
+ "scene393",
224
+ "scene394",
225
+ "scene395",
226
+ "scene396",
227
+ "scene397",
228
+ "scene399",
229
+ "scene400",
230
+ "scene401",
231
+ "scene403",
232
+ "scene404",
233
+ "scene405",
234
+ "scene407",
235
+ "scene408",
236
+ "scene410",
237
+ "scene411",
238
+ "scene412",
239
+ "scene413",
240
+ "scene415",
241
+ "scene418",
242
+ "scene419",
243
+ "scene421",
244
+ "scene422",
245
+ "scene424",
246
+ "scene425",
247
+ "scene427",
248
+ "scene428",
249
+ "scene430",
250
+ "scene431",
251
+ "scene434",
252
+ "scene435",
253
+ "scene437",
254
+ "scene439",
255
+ "scene440",
256
+ "scene441",
257
+ "scene442",
258
+ "scene443",
259
+ "scene444",
260
+ "scene445",
261
+ "scene446",
262
+ "scene447",
263
+ "scene448",
264
+ "scene449",
265
+ "scene450",
266
+ "scene452",
267
+ "scene453",
268
+ "scene454",
269
+ "scene456",
270
+ "scene457",
271
+ "scene459",
272
+ "scene460",
273
+ "scene462",
274
+ "scene463",
275
+ "scene464",
276
+ "scene465",
277
+ "scene466",
278
+ "scene467",
279
+ "scene468",
280
+ "scene471",
281
+ "scene472",
282
+ "scene473",
283
+ "scene474",
284
+ "scene475",
285
+ "scene477",
286
+ "scene478",
287
+ "scene479",
288
+ "scene480",
289
+ "scene481",
290
+ "scene482",
291
+ "scene484",
292
+ "scene485",
293
+ "scene488",
294
+ "scene489",
295
+ "scene490",
296
+ "scene491",
297
+ "scene494",
298
+ "scene495",
299
+ "scene496",
300
+ "scene500",
301
+ "scene503",
302
+ "scene504",
303
+ "scene505",
304
+ "scene506",
305
+ "scene507",
306
+ "scene508",
307
+ "scene509",
308
+ "scene510",
309
+ "scene515",
310
+ "scene517",
311
+ "scene518",
312
+ "scene519",
313
+ "scene520",
314
+ "scene521",
315
+ "scene524",
316
+ "scene525",
317
+ "scene526",
318
+ "scene527",
319
+ "scene528",
320
+ "scene531",
321
+ "scene532",
322
+ "scene533",
323
+ "scene534",
324
+ "scene536",
325
+ "scene537",
326
+ "scene539",
327
+ "scene540",
328
+ "scene541",
329
+ "scene542",
330
+ "scene543",
331
+ "scene544",
332
+ "scene545",
333
+ "scene546",
334
+ "scene547",
335
+ "scene548",
336
+ "scene549",
337
+ "scene550",
338
+ "scene552",
339
+ "scene554",
340
+ "scene556",
341
+ "scene559",
342
+ "scene561",
343
+ "scene562",
344
+ "scene563",
345
+ "scene564",
346
+ "scene565",
347
+ "scene566",
348
+ "scene569",
349
+ "scene570",
350
+ "scene571",
351
+ "scene572",
352
+ "scene573",
353
+ "scene574",
354
+ "scene575",
355
+ "scene576",
356
+ "scene578",
357
+ "scene580",
358
+ "scene581",
359
+ "scene582",
360
+ "scene585",
361
+ "scene586",
362
+ "scene587",
363
+ "scene588",
364
+ "scene591",
365
+ "scene592",
366
+ "scene593",
367
+ "scene594",
368
+ "scene595",
369
+ "scene596",
370
+ "scene597",
371
+ "scene598",
372
+ "scene599",
373
+ "scene600",
374
+ "scene601",
375
+ "scene603",
376
+ "scene604",
377
+ "scene605",
378
+ "scene607",
379
+ "scene608",
380
+ "scene609",
381
+ "scene610",
382
+ "scene611",
383
+ "scene612",
384
+ "scene613",
385
+ "scene614",
386
+ "scene615",
387
+ "scene616",
388
+ "scene617",
389
+ "scene618",
390
+ "scene620",
391
+ "scene621",
392
+ "scene622",
393
+ "scene623",
394
+ "scene626",
395
+ "scene628",
396
+ "scene629",
397
+ "scene630",
398
+ "scene631",
399
+ "scene634",
400
+ "scene637",
401
+ "scene638",
402
+ "scene639",
403
+ "scene640",
404
+ "scene641",
405
+ "scene642",
406
+ "scene643",
407
+ "scene644",
408
+ "scene646",
409
+ "scene647",
410
+ "scene652",
411
+ "scene657",
412
+ "scene661",
413
+ "scene662",
414
+ "scene663",
415
+ "scene665",
416
+ "scene666",
417
+ "scene669",
418
+ "scene674",
419
+ "scene675",
420
+ "scene676",
421
+ "scene677",
422
+ "scene682",
423
+ "scene688",
424
+ "scene690",
425
+ "scene697",
426
+ "scene699",
427
+ "scene702",
428
+ "scene704",
429
+ "scene706",
430
+ "scene709",
431
+ "scene710",
432
+ "scene712",
433
+ "scene715",
434
+ "scene719",
435
+ "scene720",
436
+ "scene721",
437
+ "scene729",
438
+ "scene741",
439
+ "scene745",
440
+ "scene747",
441
+ "scene749",
442
+ "scene757",
443
+ "scene758",
444
+ "scene759",
445
+ "scene760",
446
+ "scene766",
447
+ "scene767",
448
+ "scene769",
449
+ "scene770",
450
+ "scene771",
451
+ "scene777",
452
+ "scene778",
453
+ "scene786",
454
+ "scene787",
455
+ "scene794",
456
+ "scene796",
457
+ "scene798",
458
+ "scene799",
459
+ "scene800",
460
+ "scene802",
461
+ "scene803",
462
+ "scene807",
463
+ "scene812",
464
+ "scene813",
465
+ "scene814",
466
+ "scene815",
467
+ "scene818",
468
+ "scene820",
469
+ "scene822",
470
+ "scene828",
471
+ "scene829",
472
+ "scene838",
473
+ "scene839",
474
+ "scene840",
475
+ "scene846",
476
+ "scene848",
477
+ "scene857",
478
+ "scene860",
479
+ "scene862",
480
+ "scene863",
481
+ "scene866",
482
+ "scene869",
483
+ "scene874",
484
+ "scene877",
485
+ "scene878",
486
+ "scene880",
487
+ "scene882",
488
+ "scene883",
489
+ "scene885",
490
+ "scene890",
491
+ "scene891",
492
+ "scene901",
493
+ "scene908",
494
+ "scene910",
495
+ "scene912",
496
+ "scene915",
497
+ "scene916",
498
+ "scene919",
499
+ "scene923",
500
+ "scene926",
501
+ "scene928",
502
+ "scene932",
503
+ "scene933",
504
+ "scene935",
505
+ "scene939",
506
+ "scene946",
507
+ "scene947",
508
+ "scene948",
509
+ "scene956"
510
+ ]
511
+ }
adapters/scannetpp/pipeline.py ADDED
@@ -0,0 +1,1967 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ """
3
+ PLY 全流程 Pipeline(纯 Python,无需 Blender)
4
+
5
+ 从 .ply 点云/网格文件出发,完成:
6
+ Phase 0: 加载场景 + 获取 AABB 边界
7
+ Phase 1: 多高度层撒点 + 7 层过滤(trimesh ray_cast 替代 bpy)
8
+ Phase 2: 边渲边选(Open3D ERP 点云渲染 + 深度图)
9
+
10
+ 输出格式与 run_blend_pipeline.py 完全一致:
11
+ panorama_XXXX.png + panorama_XXXX_depth.npy + pose_XXXX.json
12
+
13
+ 坐标系: ERPT_native 右手系 [X右, Y上, Z前]
14
+ PLY 坐标系通常为 Z-up,渲染前统一转换为 Y-up。
15
+
16
+ 运行:
17
+ python run_ply_pipeline.py \\
18
+ --ply /path/to/scene.ply \\
19
+ --output-dir /path/to/output \\
20
+ --num-frames 30 \\
21
+ --resolution 2048,1024
22
+
23
+ 依赖:
24
+ pip install open3d trimesh numpy opencv-python pillow
25
+ """
26
+
27
+ import argparse
28
+ import json
29
+ import math
30
+ import os
31
+ import random as _random
32
+ import sys
33
+ import time
34
+ from concurrent.futures import ThreadPoolExecutor
35
+ from pathlib import Path
36
+ from typing import Optional
37
+
38
+ import numpy as np
39
+ import trimesh
40
+ import open3d as o3d
41
+ import cv2
42
+
43
+ # ── GPU 支持检测 ──────────────────────────────────────────────────────────────
44
+ try:
45
+ import torch
46
+ import torch.nn.functional as _F
47
+ _CUDA_AVAILABLE = torch.cuda.is_available()
48
+ _TORCH_DEVICE = torch.device("cuda") if _CUDA_AVAILABLE else torch.device("cpu")
49
+ if _CUDA_AVAILABLE:
50
+ print(f"[GPU] CUDA 可用: {torch.cuda.get_device_name(0)}")
51
+ else:
52
+ print("[GPU] CUDA 不可用,使用 CPU 渲染")
53
+ except ImportError:
54
+ torch = None
55
+ _CUDA_AVAILABLE = False
56
+ _TORCH_DEVICE = None
57
+ print("[GPU] torch 未安装,使用 CPU 渲染")
58
+
59
+
60
+ WARP_H = 128
61
+ WARP_W = 256
62
+ MARGIN = 0.2 # 距边界最小安全距离(PLY 场景通常比 blend 精度低,稍微宽松)
63
+
64
+ DEFAULT_STOP_GAIN = 0.08
65
+ DEFAULT_OVERLAP_PENALTY = 0.5
66
+ DEFAULT_MIN_DIST = 0.6
67
+ DEFAULT_MIN_FRAMES = 5
68
+
69
+ ROTATION_TYPES = {
70
+ "none": [0.0, 0.0, 0.0],
71
+ "rotate_x_90": [math.pi / 2, 0.0, 0.0],
72
+ "rotate_x_180": [math.pi, 0.0, 0.0],
73
+ "rotate_z_90": [0.0, 0.0, math.pi / 2],
74
+ }
75
+
76
+
77
+ def get_camera_rot(rotation_type: str, frame_id: int):
78
+ if rotation_type == "random_yaw":
79
+ yaw = 0.0 if frame_id == 0 else _random.uniform(0, 2 * math.pi)
80
+ return [math.pi / 2, 0.0, yaw]
81
+ return list(ROTATION_TYPES[rotation_type])
82
+
83
+
84
+ def parse_args():
85
+ parser = argparse.ArgumentParser(description="PLY Pipeline(边渲边选)")
86
+ parser.add_argument("--ply", type=str, required=True,
87
+ help=".ply 文件路径")
88
+ parser.add_argument("--output-dir", type=str, required=True,
89
+ help="输出目录")
90
+ parser.add_argument("--num-frames", type=int, default=30)
91
+ parser.add_argument("--resolution", type=str, default="2048,1024",
92
+ help="渲染分辨率 width,height")
93
+ parser.add_argument("--grid-spacing", type=float, default=0.5,
94
+ help="候选点网格间距(米)")
95
+ parser.add_argument("--camera-height", type=float, default=None,
96
+ help="固定相机高度(米),None=自动多层")
97
+ parser.add_argument("--stop-gain", type=float, default=DEFAULT_STOP_GAIN)
98
+ parser.add_argument("--stop-score", type=float, default=-0.3)
99
+ parser.add_argument("--stop-delta", type=float, default=0.08)
100
+ parser.add_argument("--min-frames", type=int, default=DEFAULT_MIN_FRAMES)
101
+ parser.add_argument("--rotation-type", type=str, default="random_yaw",
102
+ choices=["none", "rotate_x_90", "rotate_x_180",
103
+ "rotate_z_90", "random_yaw"])
104
+ parser.add_argument("--point-size", type=float, default=2.0,
105
+ help="点云渲染点径(像素)")
106
+ parser.add_argument("--z-up", action="store_true", default=True,
107
+ help="PLY 坐标系为 Z-up(默认 True,转为 Y-up)")
108
+ parser.add_argument("--no-z-up", dest="z_up", action="store_false")
109
+ return parser.parse_args()
110
+
111
+
112
+ def load_ply_scene(ply_path: str, z_up: bool = True):
113
+ """加载 PLY,可选将 Z-up 转为 Y-up(ERPT_native)
114
+
115
+ PLY 常见坐标系:
116
+ Z-up: X右, Y前, Z上 → 转换: X'=X, Y'=Z, Z'=Y(ERPT_native)
117
+ Y-up: X右, Y上, Z前 → 直接使用
118
+
119
+ Returns:
120
+ mesh_or_pc: trimesh 对象(Mesh 或 PointCloud)
121
+ pts_world: np.ndarray (N,3) Y-up 世界点坐标
122
+ bmin, bmax: AABB (3,) float
123
+ is_mesh: bool, True=Trimesh Mesh(支持 ray_cast)
124
+ faces: np.ndarray (F,3) int 或 None(纯点云时为 None)
125
+ """
126
+ print(f"\n[Phase 0] 加载场景: {ply_path}")
127
+ scene_or_mesh = trimesh.load(ply_path, process=False, force=None)
128
+
129
+ # trimesh 可能返回 Scene(多个 mesh 合并)
130
+ if isinstance(scene_or_mesh, trimesh.Scene):
131
+ mesh = trimesh.util.concatenate(
132
+ [g for g in scene_or_mesh.geometry.values()
133
+ if isinstance(g, trimesh.Trimesh)]
134
+ )
135
+ is_mesh = True
136
+ elif isinstance(scene_or_mesh, trimesh.Trimesh):
137
+ mesh = scene_or_mesh
138
+ is_mesh = True
139
+ elif isinstance(scene_or_mesh, trimesh.PointCloud):
140
+ mesh = scene_or_mesh
141
+ is_mesh = False
142
+ else:
143
+ # 尝试强制为 PointCloud
144
+ mesh = trimesh.load(ply_path, process=False, force='mesh')
145
+ is_mesh = isinstance(mesh, trimesh.Trimesh)
146
+
147
+ # 获取顶点坐标和面数据
148
+ pts_raw = np.array(mesh.vertices, dtype=np.float64)
149
+ faces = np.array(mesh.faces, dtype=np.int32) if is_mesh else None
150
+
151
+ print(f" 点数: {len(pts_raw)}, 面数: {len(faces) if faces is not None else 0}, is_mesh={is_mesh}")
152
+
153
+ # 坐标系转换 Z-up → Y-up(ERPT_native)
154
+ if z_up:
155
+ pts_world = pts_raw[:, [0, 2, 1]].copy()
156
+ else:
157
+ pts_world = pts_raw.copy()
158
+
159
+ bmin = pts_world.min(axis=0)
160
+ bmax = pts_world.max(axis=0)
161
+
162
+ print(f" AABB (Y-up): min=[{bmin[0]:.2f}, {bmin[1]:.2f}, {bmin[2]:.2f}] "
163
+ f"max=[{bmax[0]:.2f}, {bmax[1]:.2f}, {bmax[2]:.2f}]")
164
+
165
+ return mesh, pts_world, bmin, bmax, is_mesh, faces
166
+
167
+
168
+ class RayCaster:
169
+ """封装 trimesh RayMeshIntersector,提供与 Blender ray_cast 相同的接口。
170
+
171
+ 对于纯点云(非 mesh)场景,降级为"无碰撞"模式(所有射线无 hit),
172
+ 只能依靠 AABB 做粗略过滤。
173
+ """
174
+
175
+ def __init__(self, mesh, pts_world: np.ndarray, bmin, bmax,
176
+ is_mesh: bool, z_up: bool = True):
177
+ self.is_mesh = is_mesh
178
+ self.pts_world = pts_world
179
+ self.bmin = np.array(bmin)
180
+ self.bmax = np.array(bmax)
181
+ self.z_up = z_up
182
+ self._intersector = None
183
+
184
+ if is_mesh and isinstance(mesh, trimesh.Trimesh):
185
+ if z_up:
186
+ # 需要把 mesh 顶点也转为 Y-up
187
+ verts = np.array(mesh.vertices, dtype=np.float64)
188
+ verts_yup = verts[:, [0, 2, 1]]
189
+ import copy
190
+ m2 = copy.deepcopy(mesh)
191
+ m2.vertices = verts_yup
192
+ self._intersector = trimesh.ray.ray_pyembree.RayMeshIntersector(m2) \
193
+ if hasattr(trimesh.ray, 'ray_pyembree') \
194
+ else trimesh.ray.ray_triangle.RayMeshIntersector(m2)
195
+ else:
196
+ self._intersector = trimesh.ray.ray_pyembree.RayMeshIntersector(mesh) \
197
+ if hasattr(trimesh.ray, 'ray_pyembree') \
198
+ else trimesh.ray.ray_triangle.RayMeshIntersector(mesh)
199
+ print(" [RayCaster] 使用 trimesh RayMeshIntersector")
200
+ else:
201
+ print(" [RayCaster] 非 Mesh 场景,使用 AABB 降级模式")
202
+
203
+ def cast_ray(self, origin: np.ndarray, direction: np.ndarray):
204
+ """单条射线,返回 (hit: bool, dist: float)
205
+
206
+ hit=True 时 dist 为交点距离(米)。
207
+ hit=False 时 dist=inf。
208
+ """
209
+ if self._intersector is None:
210
+ return False, float('inf')
211
+
212
+ o = np.array(origin, dtype=np.float64)[np.newaxis] # (1,3)
213
+ d = np.array(direction, dtype=np.float64)[np.newaxis]
214
+ d = d / (np.linalg.norm(d) + 1e-12)
215
+
216
+ try:
217
+ locs, idx_ray, idx_tri = self._intersector.intersects_location(
218
+ o, d, multiple_hits=True)
219
+ except Exception:
220
+ return False, float('inf')
221
+
222
+ if len(locs) == 0:
223
+ return False, float('inf')
224
+
225
+ dists = np.linalg.norm(locs - origin, axis=1)
226
+ # 过滤极近距离(防止自交)
227
+ valid = dists > 1e-4
228
+ if not np.any(valid):
229
+ return False, float('inf')
230
+
231
+ min_dist = float(dists[valid].min())
232
+ return True, min_dist
233
+
234
+ def cast_rays_batch(self, origin: np.ndarray,
235
+ directions: np.ndarray) -> np.ndarray:
236
+ """批量射线,返回 dist 数组 (N,),无 hit 为 inf。"""
237
+ if self._intersector is None:
238
+ return np.full(len(directions), float('inf'))
239
+
240
+ origins = np.tile(origin[np.newaxis], (len(directions), 1))
241
+ dirs = directions / (np.linalg.norm(directions, axis=1, keepdims=True) + 1e-12)
242
+
243
+ try:
244
+ locs, idx_ray, idx_tri = self._intersector.intersects_location(
245
+ origins, dirs, multiple_hits=True)
246
+ except Exception:
247
+ return np.full(len(directions), float('inf'))
248
+
249
+ dists_out = np.full(len(directions), float('inf'))
250
+ if len(locs) == 0:
251
+ return dists_out
252
+
253
+ # 每条射线取最近交点
254
+ for i, (loc, ir) in enumerate(zip(locs, idx_ray)):
255
+ d = float(np.linalg.norm(loc - origin))
256
+ if d > 1e-4 and d < dists_out[ir]:
257
+ dists_out[ir] = d
258
+
259
+ return dists_out
260
+
261
+
262
+ def compute_camera_heights(floor_y: float, ceiling_y: float,
263
+ manual_height=None):
264
+ """计算相机高度层(Y-up 坐标系,Y=高度)"""
265
+ CEIL_CLEARANCE = 0.3
266
+ FIXED_HEIGHTS = [0.5, 0.8, 1.2, 1.7, 2.1]
267
+
268
+ if manual_height is not None:
269
+ return [manual_height]
270
+
271
+ room_h = ceiling_y - floor_y
272
+ if room_h <= 0:
273
+ return [floor_y + 1.5]
274
+
275
+ heights = []
276
+ for eye_h in FIXED_HEIGHTS:
277
+ z = floor_y + eye_h
278
+ if z < ceiling_y - CEIL_CLEARANCE:
279
+ heights.append(z)
280
+
281
+ if room_h > 3.0:
282
+ cur_h = FIXED_HEIGHTS[-1]
283
+ step = 1.0
284
+ while True:
285
+ cur_h += step
286
+ z = floor_y + cur_h
287
+ if z >= ceiling_y - CEIL_CLEARANCE:
288
+ break
289
+ heights.append(z)
290
+ step = min(step + 0.5, 3.0)
291
+
292
+ top_y = ceiling_y - CEIL_CLEARANCE
293
+ if heights and top_y > max(heights) + 0.5:
294
+ heights.append(top_y)
295
+ elif not heights and top_y > floor_y + 0.5:
296
+ heights.append(top_y)
297
+
298
+ return sorted(set(round(h, 2) for h in heights)) if heights else [floor_y + 1.5]
299
+
300
+
301
+ def generate_candidate_grid(bmin, bmax, x_spacing, z_spacing, heights):
302
+ """生成候选点网格(Y-up 坐标系:X=右, Y=高, Z=前)
303
+
304
+ heights 是 Y 方向的高度值列表。
305
+ """
306
+ cx = (bmin[0] + bmax[0]) / 2
307
+ cz = (bmin[2] + bmax[2]) / 2
308
+
309
+ x_half = int((bmax[0] - cx - MARGIN) / x_spacing)
310
+ z_half = int((bmax[2] - cz - MARGIN) / z_spacing)
311
+
312
+ xz_offsets = []
313
+ for ix in range(-x_half, x_half + 1):
314
+ for iz in range(-z_half, z_half + 1):
315
+ x = cx + ix * x_spacing
316
+ z = cz + iz * z_spacing
317
+ if (bmin[0] + MARGIN <= x <= bmax[0] - MARGIN and
318
+ bmin[2] + MARGIN <= z <= bmax[2] - MARGIN):
319
+ xz_offsets.append((ix * ix + iz * iz, x, z))
320
+ xz_offsets.sort(key=lambda t: t[0])
321
+
322
+ candidates = []
323
+ for y in heights:
324
+ for _, x, z in xz_offsets:
325
+ candidates.append([float(x), float(y), float(z)])
326
+
327
+ n_xz = len(xz_offsets)
328
+ print(f" 网格: {n_xz}点/层 x {len(heights)}层 = {len(candidates)} 个候选")
329
+ return candidates
330
+
331
+
332
+ def _build_26_directions_yup():
333
+ """26 方向球面采样(Y-up 坐标系:水平面=XZ,竖直=Y)"""
334
+ dirs = []
335
+ # 水平 16 方向(XZ 平面)
336
+ for i in range(16):
337
+ a = i * (2 * math.pi / 16)
338
+ dirs.append(np.array([math.cos(a), 0.0, math.sin(a)]))
339
+ # 上方 5 方向
340
+ elev = math.pi / 4
341
+ for i in range(5):
342
+ a = i * (2 * math.pi / 5)
343
+ dirs.append(np.array([
344
+ math.cos(a) * math.cos(elev),
345
+ math.sin(elev),
346
+ math.sin(a) * math.cos(elev),
347
+ ]))
348
+ # 下方 5 方向
349
+ for i in range(5):
350
+ a = i * (2 * math.pi / 5)
351
+ dirs.append(np.array([
352
+ math.cos(a) * math.cos(elev),
353
+ -math.sin(elev),
354
+ math.sin(a) * math.cos(elev),
355
+ ]))
356
+ return dirs
357
+
358
+
359
+ def raycast_filter(candidates, raycaster: RayCaster, room_height: float,
360
+ min_wall_dist: float = 1.0):
361
+ """7 层候选点过滤(Y-up 坐标系)
362
+
363
+ 第 1 层: 室内检测(朝+Y/-Y 各一条射线,距离合理)
364
+ 第 2 层: 穿模检测(≥2 方向 < 0.2m)
365
+ 第 3 层: 角落检测(>50% 水平方向 < 1.0m)
366
+ 第 4 层: 包裹检测(hit_rate≥90% + CV<0.30 + max<8m)
367
+ 第 5 层: 贴墙检测(水平 16 方向最近 < 0.3m)
368
+ 第 6 层: 视野质量(有效命中比例 < 35%)
369
+ 第 7 层: 窄缝检测(对向水平距离之和 < 1.5m)
370
+
371
+ 非 Mesh 场景(降级模式):跳过射线过滤,仅做 AABB 内判断。
372
+ """
373
+ if raycaster._intersector is None:
374
+ print(" [过滤] 非 Mesh 场景,跳过射线过滤,返回所有 AABB 内候选")
375
+ bmin, bmax = raycaster.bmin, raycaster.bmax
376
+ passed = [c for c in candidates
377
+ if all(bmin[i] + MARGIN <= c[i] <= bmax[i] - MARGIN
378
+ for i in [0, 2])]
379
+ print(f" 过滤统计: 总计={len(candidates)}, 通过={len(passed)}")
380
+ return passed
381
+
382
+ DIRS_26 = _build_26_directions_yup()
383
+ n26 = len(DIRS_26)
384
+
385
+ dir_up = np.array([0.0, 1.0, 0.0])
386
+ dir_down = np.array([0.0, -1.0, 0.0])
387
+ max_up = max(5.0, room_height)
388
+ max_down = max(3.0, room_height)
389
+
390
+ MIN_WALL_CLEARANCE = 0.3
391
+ VIEW_GOOD_MIN = 0.5
392
+ VIEW_GOOD_MAX = 20.0
393
+ VIEW_GOOD_RATIO = 0.35
394
+ MIN_SLIT_WIDTH = 1.5
395
+
396
+ N = len(candidates)
397
+ passed = []
398
+ stats = {"无天花板": 0, "无地板": 0, "穿模": 0, "角落": 0,
399
+ "包裹": 0, "贴墙": 0, "视野差": 0, "窄缝": 0}
400
+
401
+ t0 = time.time()
402
+ log_interval = max(1, N // 10)
403
+
404
+ for idx, pos in enumerate(candidates):
405
+ if idx % log_interval == 0 and idx > 0:
406
+ print(f" 过滤进度: {idx}/{N} ({idx*100//N}%)", flush=True)
407
+
408
+ origin = np.array(pos, dtype=np.float64)
409
+
410
+ # 第 1 层: 室内检测(Y-up:朝上=+Y,朝下=-Y)
411
+ hit_up, d_up = raycaster.cast_ray(origin, dir_up)
412
+ if not hit_up or d_up > max_up:
413
+ stats["无天花板"] += 1
414
+ continue
415
+
416
+ hit_dn, d_dn = raycaster.cast_ray(origin, dir_down)
417
+ if not hit_dn or d_dn > max_down:
418
+ stats["无地板"] += 1
419
+ continue
420
+
421
+ # 第 2~7 层: 26 方向采样
422
+ dists = raycaster.cast_rays_batch(origin, np.array(DIRS_26))
423
+
424
+ # 第 2 层: 穿模
425
+ n_close = int(np.sum(dists < 0.2))
426
+ if n_close >= 2:
427
+ stats["穿模"] += 1
428
+ continue
429
+
430
+ # 第 3 层: 角落(水平 16 方向)
431
+ n_wall = int(np.sum(dists[:16] < min_wall_dist))
432
+ if n_wall > 8:
433
+ stats["角落"] += 1
434
+ continue
435
+
436
+ # 第 4 层: 包裹
437
+ finite = dists[np.isfinite(dists)]
438
+ hit_rate = len(finite) / n26
439
+ if hit_rate >= 0.90 and len(finite) >= 2:
440
+ mean_d = float(finite.mean())
441
+ max_d = float(finite.max())
442
+ if mean_d > 0:
443
+ cv = float(finite.std()) / mean_d
444
+ if cv < 0.30 and max_d < 8.0:
445
+ stats["包裹"] += 1
446
+ continue
447
+
448
+ # 第 5 层: 贴墙
449
+ horiz_finite = dists[:16][np.isfinite(dists[:16])]
450
+ if len(horiz_finite) > 0 and float(horiz_finite.min()) < MIN_WALL_CLEARANCE:
451
+ stats["贴墙"] += 1
452
+ continue
453
+
454
+ # 第 6 层: 视野质量
455
+ n_good = int(np.sum((dists >= VIEW_GOOD_MIN) & (dists <= VIEW_GOOD_MAX)))
456
+ if n_good / n26 < VIEW_GOOD_RATIO:
457
+ stats["视野差"] += 1
458
+ continue
459
+
460
+ # 第 7 层: 窄缝
461
+ in_slit = False
462
+ for i in range(8):
463
+ d_fwd = dists[i] if np.isfinite(dists[i]) else 999
464
+ d_bwd = dists[i + 8] if np.isfinite(dists[i + 8]) else 999
465
+ if d_fwd + d_bwd < MIN_SLIT_WIDTH:
466
+ in_slit = True
467
+ break
468
+ if in_slit:
469
+ stats["窄缝"] += 1
470
+ continue
471
+
472
+ passed.append(pos)
473
+
474
+ dt = time.time() - t0
475
+ print(f" 过滤统计 ({dt:.1f}s): 总计={N}, 通过={len(passed)}")
476
+ for k, v in stats.items():
477
+ if v > 0:
478
+ print(f" ❌ {k}: {v} ({v * 100 // max(N, 1)}%)")
479
+
480
+ return passed
481
+
482
+
483
+ def _euler_to_rotation_matrix(rx: float, ry: float, rz: float) -> np.ndarray:
484
+ """XYZ 欧拉角 → 旋转矩阵(用于 ERP 相机朝向,Y-up 坐标系)"""
485
+ cx, sx = math.cos(rx), math.sin(rx)
486
+ cy, sy = math.cos(ry), math.sin(ry)
487
+ cz, sz = math.cos(rz), math.sin(rz)
488
+
489
+ Rx = np.array([[1, 0, 0], [0, cx, -sx], [0, sx, cx]])
490
+ Ry = np.array([[cy, 0, sy], [0, 1, 0], [-sy, 0, cy]])
491
+ Rz = np.array([[cz, -sz, 0], [sz, cz, 0], [0, 0, 1]])
492
+ return Rz @ Ry @ Rx
493
+
494
+
495
+ def render_erp_pointcloud(pts_world: np.ndarray,
496
+ cam_pos: np.ndarray,
497
+ cam_rot_euler: list,
498
+ width: int,
499
+ height: int,
500
+ point_size: float = 2.0):
501
+ """将点云渲染为 ERP 全景图(等距圆柱投影)
502
+
503
+ 算法:
504
+ 1. 将所有世界点变换到相机坐标系
505
+ 2. 计算每个点的方位角 (lon) 和仰角 (lat)(Y-up 右手系)
506
+ 3. 投影到 ERP 像素坐标
507
+ 4. 用 Z-buffer 填充 RGB + depth 图,splat_radius=point_size
508
+
509
+ 坐标系 (ERPT_native, Y-up):
510
+ 相机前向 = +Z_cam, 上方 = +Y_cam, 右方 = +X_cam
511
+ lon = atan2(x_cam, z_cam) (正前方=0,右=+)
512
+ lat = atan2(y_cam, sqrt(x^2+z^2))(上=+π/2)
513
+
514
+ Returns:
515
+ rgb : np.ndarray (H, W, 3) uint8
516
+ depth : np.ndarray (H, W) float32,range depth(米),0=无效
517
+ """
518
+ o3d = o3d
519
+
520
+ cam_pos = np.array(cam_pos, dtype=np.float64)
521
+ # 旋转矩阵:world → camera
522
+ # 相机默认朝向 +Z,根据欧拉角旋转
523
+ R_cw = _euler_to_rotation_matrix(*cam_rot_euler) # cam_to_world
524
+ R_wc = R_cw.T # world_to_cam
525
+
526
+ # 变换点云到相机坐标系
527
+ vecs = pts_world - cam_pos # (N, 3)
528
+ pts_cam = (R_wc @ vecs.T).T # (N, 3)
529
+
530
+ x_c = pts_cam[:, 0]
531
+ y_c = pts_cam[:, 1]
532
+ z_c = pts_cam[:, 2]
533
+
534
+ # 计算经纬度(ERPT_native 约定)
535
+ lon = np.arctan2(x_c, z_c) # [-π, π]
536
+ r_xz = np.sqrt(x_c ** 2 + z_c ** 2)
537
+ lat = np.arctan2(y_c, r_xz) # [-π/2, π/2]
538
+
539
+ # 转为像素坐标
540
+ u = ((lon / (2 * math.pi) + 0.5) * width).astype(np.float32)
541
+ v = ((0.5 - lat / math.pi) * height).astype(np.float32)
542
+ u = np.clip(u, 0, width - 1).astype(np.int32)
543
+ v = np.clip(v, 0, height - 1).astype(np.int32)
544
+
545
+ # range depth = 射线距离(米)
546
+ dist = np.sqrt(x_c ** 2 + y_c ** 2 + z_c ** 2).astype(np.float32)
547
+
548
+ # 尝试获取点云颜色
549
+ has_colors = hasattr(pts_world, '_colors')
550
+ colors_rgb = None
551
+
552
+ # 初始化图像缓冲区
553
+ rgb_buf = np.zeros((height, width, 3), dtype=np.uint8)
554
+ depth_buf = np.full((height, width), np.inf, dtype=np.float32)
555
+
556
+ # Z-buffer 渲染(每点 splat_radius 像素)
557
+ radius = max(1, int(round(point_size / 2)))
558
+
559
+ # 为效率起见,用 numpy 向量化做单像素填充,然后 dilate
560
+ # 先做精确 Z-buffer(单像素)
561
+ for i in np.argsort(dist)[::-1]: # 从远到近,近的覆盖远的
562
+ ui, vi = u[i], v[i]
563
+ di = dist[i]
564
+ if di <= 0 or not np.isfinite(di):
565
+ continue
566
+ if di < depth_buf[vi, ui]:
567
+ depth_buf[vi, ui] = di
568
+ if colors_rgb is not None:
569
+ rgb_buf[vi, ui] = colors_rgb[i]
570
+ else:
571
+ # 无颜色时用伪彩色(深度着色)
572
+ c = int(np.clip(255 * (1.0 - di / 20.0), 0, 255))
573
+ rgb_buf[vi, ui] = [c, c, c]
574
+
575
+ # 如果有 Open3D 点云颜色,补充颜色
576
+ # (此处暂用灰度,完整颜色在下方 _render_with_colors 中处理)
577
+ depth_out = np.where(np.isfinite(depth_buf), depth_buf, 0.0).astype(np.float32)
578
+ return rgb_buf, depth_out
579
+
580
+
581
+ def _gpu_align_u(u_ref, u_other, W: int):
582
+ """把 u_other 对齐到与 u_ref 最近的 ERP 循环副本(GPU tensor)"""
583
+ half_w = float(W) / 2.0
584
+ diff = u_other - u_ref
585
+ u_other = torch.where(diff > half_w, u_other - W, u_other)
586
+ u_other = torch.where(diff < -half_w, u_other + W, u_other)
587
+ return u_other
588
+
589
+
590
+ def _gpu_raster_batch(u0, v0, u1, v1, u2, v2,
591
+ c0, c1, c2, d0b, d1b, d2b,
592
+ rgb_flat, depth_flat, H: int, W: int):
593
+ """完全向量化批量光栅化(无 Python for 循环)。
594
+
595
+ 将所有三角面的包围盒像素展开成一个大 tensor,一次性完成
596
+ 重心坐标计算和 scatter_reduce Z-buffer 写入。
597
+
598
+ Args:
599
+ u0/v0, u1/v1, u2/v2: (B,) float32,三顶点 ERP 像素坐标
600
+ c0/c1/c2: (B,3) float32,三顶点颜色 [0,255]
601
+ d0b/d1b/d2b: (B,) float32,三顶点距离
602
+ rgb_flat: (H*W, 3) 输出颜色缓冲(就地修改)
603
+ depth_flat: (H*W,) 输出深度缓冲(就地修改)
604
+ """
605
+ dev = u0.device
606
+
607
+ # ── 包围盒 ──────────────────────────────────────────────────────────────
608
+ u_lo = torch.clamp(torch.floor(torch.minimum(torch.minimum(u0, u1), u2)).long(), 0, W - 1)
609
+ u_hi = torch.clamp(torch.ceil (torch.maximum(torch.maximum(u0, u1), u2)).long(), 0, W - 1)
610
+ v_lo = torch.clamp(torch.floor(torch.minimum(torch.minimum(v0, v1), v2)).long(), 0, H - 1)
611
+ v_hi = torch.clamp(torch.ceil (torch.maximum(torch.maximum(v0, v1), v2)).long(), 0, H - 1)
612
+
613
+ du = u_hi - u_lo + 1
614
+ dv = v_hi - v_lo + 1
615
+ bbox_px = du * dv
616
+
617
+ # 过滤退化面 & 超大面
618
+ valid = (u_hi >= u_lo) & (v_hi >= v_lo) & (bbox_px <= 128 * 128)
619
+ if not valid.any():
620
+ return
621
+
622
+ idx = valid.nonzero(as_tuple=False).squeeze(1)
623
+ u0v = u0[idx]; v0v = v0[idx]
624
+ u1v = u1[idx]; v1v = v1[idx]
625
+ u2v = u2[idx]; v2v = v2[idx]
626
+ c0v = c0[idx]; c1v = c1[idx]; c2v = c2[idx]
627
+ d0v = d0b[idx]; d1v = d1b[idx]; d2v = d2b[idx]
628
+ u_lv = u_lo[idx]; u_hv = u_hi[idx]
629
+ v_lv = v_lo[idx]; v_hv = v_hi[idx]
630
+ duv = u_hv - u_lv + 1
631
+ dvv = v_hv - v_lv + 1
632
+ npx = duv * dvv
633
+
634
+ Bp = int(npx.sum().item())
635
+ if Bp == 0:
636
+ return
637
+
638
+ # ── 展开:repeat_interleave 把面 id 重复 npx[i] 次 ──────────────────────
639
+ face_id = torch.repeat_interleave(
640
+ torch.arange(len(idx), device=dev, dtype=torch.long), npx)
641
+
642
+ cumsum = torch.zeros(len(idx) + 1, dtype=torch.long, device=dev)
643
+ cumsum[1:] = torch.cumsum(npx, 0)
644
+ local_flat = torch.arange(Bp, device=dev, dtype=torch.long) - cumsum[face_id]
645
+
646
+ local_u = local_flat % duv[face_id]
647
+ local_v = local_flat // duv[face_id]
648
+
649
+ uu = (u_lv[face_id] + local_u).float()
650
+ vv = (v_lv[face_id] + local_v).float()
651
+
652
+ # ── 重心坐标(完全向量化) ───────────────────────────────────────────────
653
+ ax = u0v[face_id]; ay = v0v[face_id]
654
+ bx = u1v[face_id]; by = v1v[face_id]
655
+ cx = u2v[face_id]; cy = v2v[face_id]
656
+
657
+ denom = (by - cy) * (ax - cx) + (cx - bx) * (ay - cy)
658
+ safe = denom.abs() > 1e-8
659
+ inv_d = torch.where(safe, 1.0 / denom, torch.zeros_like(denom))
660
+ w0 = ((by - cy) * (uu - cx) + (cx - bx) * (vv - cy)) * inv_d
661
+ w1 = ((cy - ay) * (uu - cx) + (ax - cx) * (vv - cy)) * inv_d
662
+ w2 = 1.0 - w0 - w1
663
+
664
+ inside = safe & (w0 >= -0.01) & (w1 >= -0.01) & (w2 >= -0.01)
665
+ if not inside.any():
666
+ return
667
+
668
+ fi = face_id[inside]
669
+ uui = uu[inside].long()
670
+ vvi = vv[inside].long()
671
+ w0i = w0[inside]; w1i = w1[inside]; w2i = w2[inside]
672
+
673
+ # ── Z-buffer scatter_reduce(amin) ───────────────────────────────────────
674
+ di = w0i * d0v[fi] + w1i * d1v[fi] + w2i * d2v[fi]
675
+ lin = vvi * W + uui
676
+ depth_flat.scatter_reduce_(0, lin, di, reduce='amin', include_self=True)
677
+
678
+ # ── 颜色写入(near-wins) ────────────────────────────────────────────────
679
+ cur_d = depth_flat[lin]
680
+ winner = (di - cur_d).abs() < 1e-4
681
+ w0e = w0i[winner].unsqueeze(1)
682
+ w1e = w1i[winner].unsqueeze(1)
683
+ w2e = w2i[winner].unsqueeze(1)
684
+ fie = fi[winner]
685
+ col_i = torch.clamp(w0e * c0v[fie] + w1e * c1v[fie] + w2e * c2v[fie], 0, 255)
686
+ rgb_flat.scatter_(0, lin[winner].unsqueeze(1).expand(-1, 3), col_i)
687
+
688
+
689
+ def _gpu_raster_mesh(u_f, v_f, dist, col_t, f_t,
690
+ rgb_flat, depth_flat, H: int, W: int,
691
+ batch_size: int = 65536):
692
+ """ERP 网格光栅化主流程(含接缝三副本 + OOM 自动降级)。
693
+
694
+ 操作 rgb_flat / depth_flat 缓冲(就地修改)。
695
+ """
696
+ d0t = dist[f_t[:, 0]]; d1t = dist[f_t[:, 1]]; d2t = dist[f_t[:, 2]]
697
+ avg_d = (d0t + d1t + d2t) / 3.0
698
+ order = torch.argsort(avg_d, descending=True)
699
+ f_ord = f_t[order]
700
+ d0t, d1t, d2t = dist[f_ord[:, 0]], dist[f_ord[:, 1]], dist[f_ord[:, 2]]
701
+ c0t = col_t[f_ord[:, 0]]; c1t = col_t[f_ord[:, 1]]; c2t = col_t[f_ord[:, 2]]
702
+ u0r = u_f[f_ord[:, 0]]; u1r = u_f[f_ord[:, 1]]; u2r = u_f[f_ord[:, 2]]
703
+ v0r = v_f[f_ord[:, 0]]; v1r = v_f[f_ord[:, 1]]; v2r = v_f[f_ord[:, 2]]
704
+
705
+ valid_f = (d0t > 1e-4) & (d1t > 1e-4) & (d2t > 1e-4)
706
+ f_idx = valid_f.nonzero(as_tuple=False).squeeze(1)
707
+
708
+ def _process_batch(bi):
709
+ u0b = u0r[bi]; v0b = v0r[bi]
710
+ u1b = _gpu_align_u(u0b, u1r[bi], W)
711
+ u2b = _gpu_align_u(u0b, u2r[bi], W)
712
+ v1b = v1r[bi]; v2b = v2r[bi]
713
+ c0b = c0t[bi]; c1b = c1t[bi]; c2b = c2t[bi]
714
+ d0b_ = d0t[bi]; d1b_ = d1t[bi]; d2b_ = d2t[bi]
715
+ # 三副本 concat:主 + 左(u-W) + 右(u+W),一次送入减少 kernel launch
716
+ _gpu_raster_batch(
717
+ torch.cat([u0b, u0b - W, u0b + W]),
718
+ torch.cat([v0b, v0b, v0b ]),
719
+ torch.cat([u1b, u1b - W, u1b + W]),
720
+ torch.cat([v1b, v1b, v1b ]),
721
+ torch.cat([u2b, u2b - W, u2b + W]),
722
+ torch.cat([v2b, v2b, v2b ]),
723
+ torch.cat([c0b, c0b, c0b]),
724
+ torch.cat([c1b, c1b, c1b]),
725
+ torch.cat([c2b, c2b, c2b]),
726
+ torch.cat([d0b_, d0b_, d0b_]),
727
+ torch.cat([d1b_, d1b_, d1b_]),
728
+ torch.cat([d2b_, d2b_, d2b_]),
729
+ rgb_flat, depth_flat, H, W,
730
+ )
731
+
732
+ try:
733
+ _process_batch(f_idx)
734
+ except torch.cuda.OutOfMemoryError:
735
+ torch.cuda.empty_cache()
736
+ print(f" [WARN] OOM({len(f_idx)} 面),自动降级分批 batch={batch_size}")
737
+ for start in range(0, len(f_idx), batch_size):
738
+ _process_batch(f_idx[start: start + batch_size])
739
+
740
+
741
+ def _gpu_splat_pointcloud(u_f, v_f, dist, col_t,
742
+ rgb_flat, depth_flat, H: int, W: int,
743
+ point_size: float = 2.0):
744
+ """点云 scatter Z-buffer splatting(就地修改 rgb_flat / depth_flat)"""
745
+ valid = dist > 1e-4
746
+ u_i = torch.clamp(u_f[valid].long(), 0, W - 1)
747
+ v_i = torch.clamp(v_f[valid].long(), 0, H - 1)
748
+ dist_v = dist[valid]
749
+ col_v = col_t[valid]
750
+ lin = v_i * W + u_i
751
+ radius = max(0, int(round(point_size / 2)) - 1)
752
+
753
+ if radius == 0:
754
+ depth_flat.scatter_reduce_(0, lin, dist_v, reduce='amin', include_self=True)
755
+ sort_idx = torch.argsort(dist_v)
756
+ rgb_flat.scatter_(0, lin[sort_idx].unsqueeze(1).expand(-1, 3), col_v[sort_idx])
757
+ else:
758
+ for dr in range(-radius, radius + 1):
759
+ for dc in range(-radius, radius + 1):
760
+ v_nb = torch.clamp(v_i + dr, 0, H - 1)
761
+ u_nb = torch.clamp(u_i + dc, 0, W - 1)
762
+ depth_flat.scatter_reduce_(0, v_nb * W + u_nb, dist_v,
763
+ reduce='amin', include_self=True)
764
+ sort_idx = torch.argsort(dist_v, descending=True)
765
+ for dr in range(-radius, radius + 1):
766
+ for dc in range(-radius, radius + 1):
767
+ v_nb = torch.clamp(v_i[sort_idx] + dr, 0, H - 1)
768
+ u_nb = torch.clamp(u_i[sort_idx] + dc, 0, W - 1)
769
+ rgb_flat.scatter_(0, (v_nb * W + u_nb).unsqueeze(1).expand(-1, 3),
770
+ col_v[sort_idx])
771
+
772
+
773
+ def _gpu_fill_holes(rgb_2d, depth_out):
774
+ """GPU 空洞填充:大核 max_pool2d + 残余小孔迭代收尾。
775
+
776
+ Args:
777
+ rgb_2d: (H,W,3) float32 GPU tensor
778
+ depth_out: (H,W) float32 GPU tensor(0=空洞)
779
+
780
+ Returns:
781
+ rgb_2d: (H,W,3) float32,填充后
782
+ """
783
+ hole = (depth_out == 0)
784
+ if not hole.any():
785
+ return rgb_2d
786
+
787
+ fill_radius = 32
788
+ k = fill_radius * 2 + 1 # 65
789
+
790
+ rgb_f = rgb_2d.permute(2, 0, 1).unsqueeze(0).float() # (1,3,H,W)
791
+ valid_m = (~hole).float().unsqueeze(0).unsqueeze(0) # (1,1,H,W)
792
+
793
+ rgb_masked = rgb_f * valid_m
794
+ expanded = _F.max_pool2d(rgb_masked, kernel_size=k, stride=1, padding=fill_radius)
795
+ valid_exp = _F.max_pool2d(valid_m, kernel_size=k, stride=1, padding=fill_radius) > 0
796
+
797
+ fill_mask = hole.unsqueeze(0).unsqueeze(0) & valid_exp
798
+ rgb_f = torch.where(fill_mask.expand_as(rgb_f), expanded, rgb_f)
799
+
800
+ # 残余大孔洞:最多 8 轮 3×3 迭代收尾
801
+ hole2 = hole & ~fill_mask.squeeze(0).squeeze(0)
802
+ if hole2.any():
803
+ valid_f2 = (~hole2).float().unsqueeze(0).unsqueeze(0)
804
+ rgb_f2 = rgb_f
805
+ for _ in range(8):
806
+ if not hole2.any():
807
+ break
808
+ r2m = rgb_f2 * valid_f2
809
+ exp2 = _F.max_pool2d(r2m, kernel_size=3, stride=1, padding=1)
810
+ vd2 = _F.max_pool2d(valid_f2, kernel_size=3, stride=1, padding=1) > 0
811
+ nw2 = hole2.unsqueeze(0).unsqueeze(0) & vd2
812
+ if not nw2.any():
813
+ break
814
+ rgb_f2 = torch.where(nw2.expand_as(rgb_f2), exp2, rgb_f2)
815
+ valid_f2 = torch.where(nw2, torch.ones_like(valid_f2), valid_f2)
816
+ hole2 = hole2 & ~nw2.squeeze(0).squeeze(0)
817
+ rgb_f = rgb_f2
818
+
819
+ return rgb_f.squeeze(0).permute(1, 2, 0) # (H,W,3)
820
+
821
+
822
+ def _render_erp_gpu(pts_world: np.ndarray,
823
+ colors_world,
824
+ cam_pos,
825
+ R_wc: np.ndarray,
826
+ width: int,
827
+ height: int,
828
+ faces: np.ndarray = None,
829
+ point_size: float = 2.0,
830
+ batch_size: int = 65536) -> tuple:
831
+ """GPU(CUDA)加速的 ERP 全景渲染。
832
+
833
+ 所有计算在 GPU tensor 上完成:
834
+ 1. 顶点变换 + ERP 投影(全量向量化)
835
+ 2. 网格/点云光栅化(委托给共享辅助函数)
836
+ 3. 空洞填充:max_pool2d 大核膨胀(纯 GPU,无 cv2)
837
+
838
+ Returns:
839
+ rgb (H, W, 3) uint8 numpy
840
+ depth (H, W) float32 numpy
841
+ """
842
+ dev = _TORCH_DEVICE
843
+
844
+ # ── 1. 顶点变换到相机坐标系 ──────────────────────────────────────────────
845
+ pts = torch.from_numpy(pts_world.astype(np.float32)).to(dev)
846
+ cp = torch.from_numpy(cam_pos.astype(np.float32)).to(dev)
847
+ R = torch.from_numpy(R_wc.astype(np.float32)).to(dev)
848
+
849
+ pts_cam = (R @ (pts - cp).T).T
850
+ x_c, y_c, z_c = pts_cam[:, 0], pts_cam[:, 1], pts_cam[:, 2]
851
+
852
+ # ── 2. ERP 投影 ──────────────────────────────────────────────────────────
853
+ lon = torch.atan2(x_c, z_c)
854
+ r_xz = torch.sqrt(x_c ** 2 + z_c ** 2)
855
+ lat = torch.atan2(y_c, r_xz)
856
+ u_f = (lon / (2 * math.pi) + 0.5) * width
857
+ v_f = (0.5 - lat / math.pi) * height
858
+ dist = torch.sqrt(x_c ** 2 + y_c ** 2 + z_c ** 2)
859
+
860
+ # ── 3. 顶点颜色 ──────────────────────────────────────────────────────────
861
+ if colors_world is not None:
862
+ col_np = colors_world if colors_world.dtype == np.uint8 \
863
+ else (np.clip(colors_world, 0, 1) * 255).astype(np.uint8)
864
+ col_t = torch.from_numpy(col_np.astype(np.float32)).to(dev)
865
+ else:
866
+ d_norm = torch.clamp(dist / max(float(dist.max()), 1.0), 0, 1)
867
+ g = torch.clamp((1.0 - d_norm) * 200 + 30, 0, 255)
868
+ col_t = g.unsqueeze(1).expand(-1, 3)
869
+
870
+ H, W = height, width
871
+ INF = 1e9
872
+ rgb_flat = torch.zeros(H * W, 3, dtype=torch.float32, device=dev)
873
+ depth_flat = torch.full((H * W,), INF, dtype=torch.float32, device=dev)
874
+
875
+ # ── 4. 光栅化 ────────────────────────────────────────────────────────────
876
+ if faces is not None and len(faces) > 0:
877
+ f_t = torch.from_numpy(faces.astype(np.int64)).to(dev)
878
+ _gpu_raster_mesh(u_f, v_f, dist, col_t, f_t,
879
+ rgb_flat, depth_flat, H, W, batch_size)
880
+ else:
881
+ _gpu_splat_pointcloud(u_f, v_f, dist, col_t,
882
+ rgb_flat, depth_flat, H, W, point_size)
883
+
884
+ # ── 5. reshape ───────────────────────────────────────────────────────────
885
+ depth_2d = depth_flat.reshape(H, W)
886
+ rgb_2d = rgb_flat.reshape(H, W, 3)
887
+ depth_out = torch.where(depth_2d < INF / 2, depth_2d, torch.zeros_like(depth_2d))
888
+
889
+ # ── 6. 空洞填充 ──────────────────────────────────────────────────────────
890
+ if faces is not None and len(faces) > 0:
891
+ rgb_2d = _gpu_fill_holes(rgb_2d, depth_out)
892
+
893
+ # ── 7. 回传 numpy ──────────��─────────────────────────────────────────────
894
+ rgb_np = rgb_2d.clamp(0, 255).byte().cpu().numpy()
895
+ depth_np = depth_out.cpu().numpy().astype(np.float32)
896
+ return rgb_np, depth_np
897
+
898
+
899
+ def render_erp_batch_gpu(pts_world: np.ndarray,
900
+ colors_world,
901
+ cam_poses: list,
902
+ cam_rots: list,
903
+ width: int,
904
+ height: int,
905
+ faces: np.ndarray = None,
906
+ point_size: float = 2.0) -> list:
907
+ """并行批量渲染多个相机视角(共用同一场景,减少重复数据传输)。
908
+
909
+ 将场景数据(pts_world, colors_world, faces)只上传一次到 GPU,
910
+ 然后依次渲染 len(cam_poses) 个视角,显著减少 PCIe 传输开销。
911
+
912
+ Args:
913
+ cam_poses: list of [x, y, z],各帧相机位置
914
+ cam_rots: list of [rx, ry, rz],各帧相机欧拉角
915
+
916
+ Returns:
917
+ list of (rgb_np, depth_np) 与输入顺序对应
918
+ """
919
+ if not (_CUDA_AVAILABLE and torch is not None):
920
+ return [
921
+ render_erp_from_ply(pts_world, colors_world, pos, rot,
922
+ width, height, point_size, faces)
923
+ for pos, rot in zip(cam_poses, cam_rots)
924
+ ]
925
+
926
+ dev = _TORCH_DEVICE
927
+
928
+ # ── 场景数据上传(只做一次)──────────────────────────────────────────────
929
+ pts_t = torch.from_numpy(pts_world.astype(np.float32)).to(dev)
930
+
931
+ if colors_world is not None:
932
+ col_np = colors_world if colors_world.dtype == np.uint8 \
933
+ else (np.clip(colors_world, 0, 1) * 255).astype(np.uint8)
934
+ col_t_scene = torch.from_numpy(col_np.astype(np.float32)).to(dev)
935
+ else:
936
+ col_t_scene = None
937
+
938
+ f_t = None
939
+ if faces is not None and len(faces) > 0:
940
+ f_t = torch.from_numpy(faces.astype(np.int64)).to(dev)
941
+
942
+ # ── 逐帧渲染(场景数据复用)──────────────────────────────────────────────
943
+ results = []
944
+ for cam_pos, cam_rot in zip(cam_poses, cam_rots):
945
+ cam_pos_np = np.array(cam_pos, dtype=np.float64)
946
+ R_wc = _euler_to_rotation_matrix(*cam_rot).T
947
+
948
+ cp = torch.from_numpy(cam_pos_np.astype(np.float32)).to(dev)
949
+ R = torch.from_numpy(R_wc.astype(np.float32)).to(dev)
950
+
951
+ pts_cam = (R @ (pts_t - cp).T).T
952
+ x_c, y_c, z_c = pts_cam[:, 0], pts_cam[:, 1], pts_cam[:, 2]
953
+ lon = torch.atan2(x_c, z_c)
954
+ r_xz = torch.sqrt(x_c ** 2 + z_c ** 2)
955
+ lat = torch.atan2(y_c, r_xz)
956
+ u_f = (lon / (2 * math.pi) + 0.5) * width
957
+ v_f = (0.5 - lat / math.pi) * height
958
+ dist = torch.sqrt(x_c ** 2 + y_c ** 2 + z_c ** 2)
959
+
960
+ if col_t_scene is None:
961
+ d_norm = torch.clamp(dist / max(float(dist.max()), 1.0), 0, 1)
962
+ g = torch.clamp((1.0 - d_norm) * 200 + 30, 0, 255)
963
+ col_frame = g.unsqueeze(1).expand(-1, 3)
964
+ else:
965
+ col_frame = col_t_scene
966
+
967
+ try:
968
+ rgb_np, depth_np = _render_erp_gpu_from_projected(
969
+ u_f, v_f, dist, col_frame, f_t, width, height, point_size)
970
+ except Exception as e:
971
+ print(f" [WARN] batch GPU 渲染帧失败,回退单帧: {e}")
972
+ rgb_np, depth_np = _render_erp_gpu(
973
+ pts_world, colors_world, cam_pos_np, R_wc,
974
+ width, height, faces=faces, point_size=point_size)
975
+ results.append((rgb_np, depth_np))
976
+
977
+ return results
978
+
979
+
980
+ def _render_erp_gpu_from_projected(
981
+ u_f, v_f, dist, col_t, f_t,
982
+ width: int, height: int, point_size: float = 2.0) -> tuple:
983
+ """内部函数:从已投影的 GPU tensor 直接光栅化,省去重复的顶点变换。
984
+
985
+ Args:
986
+ u_f, v_f: (N,) float32 GPU tensor,ERP 像素浮点坐标
987
+ dist: (N,) float32 GPU tensor,各顶点到相机距离
988
+ col_t: (N,3) float32 GPU tensor,顶点颜色 [0,255]
989
+ f_t: (F,3) int64 GPU tensor 或 None
990
+ width, height: 输出分辨率
991
+ """
992
+ dev = u_f.device
993
+ H, W = height, width
994
+ INF = 1e9
995
+
996
+ rgb_flat = torch.zeros(H * W, 3, dtype=torch.float32, device=dev)
997
+ depth_flat = torch.full((H * W,), INF, dtype=torch.float32, device=dev)
998
+
999
+ if f_t is not None and len(f_t) > 0:
1000
+ _gpu_raster_mesh(u_f, v_f, dist, col_t, f_t,
1001
+ rgb_flat, depth_flat, H, W)
1002
+ else:
1003
+ _gpu_splat_pointcloud(u_f, v_f, dist, col_t,
1004
+ rgb_flat, depth_flat, H, W, point_size)
1005
+
1006
+ depth_2d = depth_flat.reshape(H, W)
1007
+ rgb_2d = rgb_flat.reshape(H, W, 3)
1008
+ depth_out = torch.where(depth_2d < INF / 2, depth_2d, torch.zeros_like(depth_2d))
1009
+
1010
+ if f_t is not None and len(f_t) > 0:
1011
+ rgb_2d = _gpu_fill_holes(rgb_2d, depth_out)
1012
+
1013
+ rgb_np = rgb_2d.clamp(0, 255).byte().cpu().numpy()
1014
+ depth_np = depth_out.cpu().numpy().astype(np.float32)
1015
+ return rgb_np, depth_np
1016
+
1017
+
1018
+ def render_erp_from_ply(pts_world: np.ndarray,
1019
+ colors_world,
1020
+ cam_pos: list,
1021
+ cam_rot_euler: list,
1022
+ width: int,
1023
+ height: int,
1024
+ point_size: float = 2.0,
1025
+ faces: np.ndarray = None):
1026
+ """带颜色的 ERP 全景图渲染(自动 dispatch 到 GPU/CPU)
1027
+
1028
+ Args:
1029
+ pts_world: (N,3) float64,Y-up 世界坐标
1030
+ colors_world: (N,3) uint8 或 float32,RGB 颜色,None=伪彩
1031
+ cam_pos: [x, y, z] 相机位置(Y-up)
1032
+ cam_rot_euler: [rx, ry, rz] 相机欧拉角(弧度)
1033
+ width, height: 输出分辨率
1034
+ point_size: splat 直径(像素),仅纯点云模式有效
1035
+ faces: (F,3) int,三角面顶点索引;有面时走面光栅化
1036
+
1037
+ Returns:
1038
+ rgb: (H, W, 3) uint8
1039
+ depth: (H, W) float32,range depth(米),0=无效
1040
+ """
1041
+ cam_pos = np.array(cam_pos, dtype=np.float64)
1042
+ R_cw = _euler_to_rotation_matrix(*cam_rot_euler)
1043
+ R_wc = R_cw.T
1044
+
1045
+ # ── GPU dispatch ──────────────────────────────────────────────────────
1046
+ if _CUDA_AVAILABLE and torch is not None:
1047
+ try:
1048
+ return _render_erp_gpu(pts_world, colors_world,
1049
+ cam_pos, R_wc,
1050
+ width, height,
1051
+ faces=faces, point_size=point_size)
1052
+ except Exception as _gpu_err:
1053
+ print(f" [WARN] GPU 渲染失败,回退 CPU: {_gpu_err}")
1054
+
1055
+ # ── CPU 路径 ──────────────────────────────────────────────────────────
1056
+ # 所有顶点变换到相机坐标系
1057
+ vecs = pts_world - cam_pos
1058
+ pts_cam = (R_wc @ vecs.T).T # (N, 3)
1059
+
1060
+ x_c = pts_cam[:, 0].astype(np.float32)
1061
+ y_c = pts_cam[:, 1].astype(np.float32)
1062
+ z_c = pts_cam[:, 2].astype(np.float32)
1063
+
1064
+ # ERP 投影:每顶点 → (u_f, v_f, dist)
1065
+ lon = np.arctan2(x_c, z_c)
1066
+ r_xz = np.sqrt(x_c ** 2 + z_c ** 2)
1067
+ lat = np.arctan2(y_c, r_xz)
1068
+ u_f = (lon / (2 * math.pi) + 0.5) * width # float 像素坐标
1069
+ v_f = (0.5 - lat / math.pi) * height
1070
+ dist = np.sqrt(x_c ** 2 + y_c ** 2 + z_c ** 2)
1071
+
1072
+ # 顶点颜色
1073
+ if colors_world is not None:
1074
+ col_all = colors_world
1075
+ if col_all.dtype != np.uint8:
1076
+ col_all = (np.clip(col_all, 0, 1) * 255).astype(np.uint8)
1077
+ else:
1078
+ d_norm = np.clip(dist / max(float(dist.max()), 1.0), 0, 1)
1079
+ g = np.clip((1.0 - d_norm) * 200 + 30, 0, 255).astype(np.uint8)
1080
+ col_all = np.stack([g, g, g], axis=1)
1081
+
1082
+ rgb_buf = np.zeros((height, width, 3), dtype=np.uint8)
1083
+ depth_buf = np.full((height, width), np.inf, dtype=np.float32)
1084
+
1085
+ if faces is not None and len(faces) > 0:
1086
+ # ── 网格模式:三角面光栅化 ──────────────────────────────────────
1087
+ f = faces.astype(np.int32)
1088
+ d0, d1, d2 = dist[f[:, 0]], dist[f[:, 1]], dist[f[:, 2]]
1089
+ face_dist = (d0 + d1 + d2) / 3.0
1090
+ valid_face = (d0 > 1e-4) & (d1 > 1e-4) & (d2 > 1e-4)
1091
+ f = f[valid_face]
1092
+ face_dist = face_dist[valid_face]
1093
+
1094
+ # 从远到近排序,近面覆盖远面
1095
+ order = np.argsort(face_dist)[::-1]
1096
+ f = f[order]
1097
+ face_dist = face_dist[order]
1098
+
1099
+ c0s = col_all[f[:, 0]].astype(np.float32)
1100
+ c1s = col_all[f[:, 1]].astype(np.float32)
1101
+ c2s = col_all[f[:, 2]].astype(np.float32)
1102
+ d0s = dist[f[:, 0]]
1103
+ d1s = dist[f[:, 1]]
1104
+ d2s = dist[f[:, 2]]
1105
+
1106
+ # 三顶点的 ERP 浮点坐标
1107
+ u0s_raw = u_f[f[:, 0]]
1108
+ u1s_raw = u_f[f[:, 1]]
1109
+ u2s_raw = u_f[f[:, 2]]
1110
+ v0s = v_f[f[:, 0]]
1111
+ v1s = v_f[f[:, 1]]
1112
+ v2s = v_f[f[:, 2]]
1113
+
1114
+ def _raster_triangle(u0v, v0v, u1v, v1v, u2v, v2v,
1115
+ c0, c1, c2, dep0, dep1, dep2):
1116
+ """将单个三角面光栅化写入 rgb_buf / depth_buf(闭包)"""
1117
+ v_min = max(0, int(math.floor(min(v0v, v1v, v2v))))
1118
+ v_max = min(height - 1, int(math.ceil(max(v0v, v1v, v2v))))
1119
+ u_min = max(0, int(math.floor(min(u0v, u1v, u2v))))
1120
+ u_max = min(width - 1, int(math.ceil(max(u0v, u1v, u2v))))
1121
+ if v_max < v_min or u_max < u_min:
1122
+ return
1123
+ vs_arr = np.arange(v_min, v_max + 1)
1124
+ us_arr = np.arange(u_min, u_max + 1)
1125
+ uu, vv = np.meshgrid(us_arr, vs_arr)
1126
+ uu = uu.flatten().astype(np.float32)
1127
+ vv = vv.flatten().astype(np.float32)
1128
+ denom = ((v1v - v2v) * (u0v - u2v) + (u2v - u1v) * (v0v - v2v))
1129
+ if abs(denom) < 1e-8:
1130
+ return
1131
+ inv_d = 1.0 / denom
1132
+ w0 = ((v1v - v2v) * (uu - u2v) + (u2v - u1v) * (vv - v2v)) * inv_d
1133
+ w1 = ((v2v - v0v) * (uu - u2v) + (u0v - u2v) * (vv - v2v)) * inv_d
1134
+ w2 = 1.0 - w0 - w1
1135
+ inside = (w0 >= -0.01) & (w1 >= -0.01) & (w2 >= -0.01)
1136
+ if not inside.any():
1137
+ return
1138
+ uu_in = uu[inside].astype(np.int32)
1139
+ vv_in = vv[inside].astype(np.int32)
1140
+ w0_in = w0[inside][:, None]
1141
+ w1_in = w1[inside][:, None]
1142
+ w2_in = w2[inside][:, None]
1143
+ di = w0_in[:, 0] * dep0 + w1_in[:, 0] * dep1 + w2_in[:, 0] * dep2
1144
+ ci_rgb = np.clip(w0_in * c0 + w1_in * c1 + w2_in * c2, 0, 255).astype(np.uint8)
1145
+ closer = di < depth_buf[vv_in, uu_in]
1146
+ if closer.any():
1147
+ depth_buf[vv_in[closer], uu_in[closer]] = di[closer]
1148
+ rgb_buf[vv_in[closer], uu_in[closer]] = ci_rgb[closer]
1149
+
1150
+ half_w = width / 2.0
1151
+
1152
+ for i in range(len(f)):
1153
+ u0v, v0v = float(u0s_raw[i]), float(v0s[i])
1154
+ u1v, v1v = float(u1s_raw[i]), float(v1s[i])
1155
+ u2v, v2v = float(u2s_raw[i]), float(v2s[i])
1156
+ c0, c1, c2 = c0s[i], c1s[i], c2s[i]
1157
+ dep0, dep1, dep2 = float(d0s[i]), float(d1s[i]), float(d2s[i])
1158
+
1159
+ # 检测是否跨越 ERP 左右边界(u 坐标差 > width/2)
1160
+ us_tri = np.array([u0v, u1v, u2v])
1161
+ u_span = float(us_tri.max() - us_tri.min())
1162
+
1163
+ if u_span > half_w:
1164
+ # 跨边界:以 u0 为基准,把 u1/u2 对齐到与 u0 最近的循环副本
1165
+ def _align(u_ref, u_other):
1166
+ diff = u_other - u_ref
1167
+ if diff > half_w:
1168
+ return u_other - width
1169
+ elif diff < -half_w:
1170
+ return u_other + width
1171
+ return u_other
1172
+
1173
+ u1_a = _align(u0v, u1v)
1174
+ u2_a = _align(u0v, u2v)
1175
+
1176
+ # 主渲染(对齐后坐标,_raster_triangle 内部 clip 到 [0, width-1])
1177
+ _raster_triangle(u0v, v0v, u1_a, v1v, u2_a, v2v, c0, c1, c2, dep0, dep1, dep2)
1178
+ # 循环副本(偏移 ±width 处理左右两侧黑边)
1179
+ _raster_triangle(u0v - width, v0v, u1_a - width, v1v, u2_a - width, v2v,
1180
+ c0, c1, c2, dep0, dep1, dep2)
1181
+ _raster_triangle(u0v + width, v0v, u1_a + width, v1v, u2_a + width, v2v,
1182
+ c0, c1, c2, dep0, dep1, dep2)
1183
+ else:
1184
+ _raster_triangle(u0v, v0v, u1v, v1v, u2v, v2v, c0, c1, c2, dep0, dep1, dep2)
1185
+
1186
+ else:
1187
+ # ── 纯点云模式:Z-buffer Splatting ────────────────────────────
1188
+ valid_mask = dist > 1e-4
1189
+ u_i = np.clip(u_f.astype(np.int32), 0, width - 1)[valid_mask]
1190
+ v_i = np.clip(v_f.astype(np.int32), 0, height - 1)[valid_mask]
1191
+ dist_v = dist[valid_mask]
1192
+ col_v = col_all[valid_mask]
1193
+
1194
+ order = np.argsort(dist_v)[::-1]
1195
+ radius = max(0, int(round(point_size / 2)) - 1)
1196
+
1197
+ if radius == 0:
1198
+ near_order = np.argsort(dist_v)
1199
+ for idx in near_order:
1200
+ vi, ui, di = v_i[idx], u_i[idx], dist_v[idx]
1201
+ if di < depth_buf[vi, ui]:
1202
+ depth_buf[vi, ui] = di
1203
+ rgb_buf[vi, ui] = col_v[idx]
1204
+ else:
1205
+ for idx in order:
1206
+ vi, ui, di = int(v_i[idx]), int(u_i[idx]), float(dist_v[idx])
1207
+ if not np.isfinite(di):
1208
+ continue
1209
+ v0 = max(0, vi - radius)
1210
+ v1 = min(height, vi + radius + 1)
1211
+ u0 = max(0, ui - radius)
1212
+ u1 = min(width, ui + radius + 1)
1213
+ region = depth_buf[v0:v1, u0:u1]
1214
+ mask = di < region
1215
+ region[mask] = di
1216
+ depth_buf[v0:v1, u0:u1] = region
1217
+ rgb_region = rgb_buf[v0:v1, u0:u1]
1218
+ rgb_region[mask] = col_v[idx]
1219
+ rgb_buf[v0:v1, u0:u1] = rgb_region
1220
+
1221
+ depth_out = np.where(np.isfinite(depth_buf), depth_buf, 0.0).astype(np.float32)
1222
+
1223
+ # ── 空洞填充:迭代最近邻复制,每轮向外扩 1 像素,不修改已有有效像素 ──────
1224
+ if faces is not None and len(faces) > 0:
1225
+ hole_mask = (depth_out == 0) # True=空洞
1226
+ if hole_mask.any():
1227
+ kernel = np.ones((3, 3), np.uint8)
1228
+ valid_u8 = (~hole_mask).astype(np.uint8)
1229
+ for _ in range(32):
1230
+ if not hole_mask.any():
1231
+ break
1232
+ dilated_valid = cv2.dilate(valid_u8, kernel)
1233
+ newly = hole_mask & (dilated_valid > 0)
1234
+ if not newly.any():
1235
+ break
1236
+ for c in range(3):
1237
+ src = rgb_buf[:, :, c]
1238
+ # dilate 在 valid 区域的颜色,传播到邻近空洞(取邻域最大值近似最近邻)
1239
+ expanded = cv2.dilate(src * valid_u8, kernel)
1240
+ rgb_buf[:, :, c] = np.where(newly, expanded, src)
1241
+ hole_mask[newly] = False
1242
+ valid_u8[newly] = 1
1243
+
1244
+ return rgb_buf, depth_out
1245
+
1246
+
1247
+ def _extract_ply_colors(mesh_or_pc) -> Optional[np.ndarray]:
1248
+ """尝试从 trimesh 对象中提取顶点颜色 (N,3) uint8"""
1249
+ try:
1250
+ if isinstance(mesh_or_pc, trimesh.Trimesh):
1251
+ if mesh_or_pc.visual is not None:
1252
+ if hasattr(mesh_or_pc.visual, 'vertex_colors'):
1253
+ vc = mesh_or_pc.visual.vertex_colors
1254
+ if vc is not None and len(vc) > 0:
1255
+ return np.array(vc[:, :3], dtype=np.uint8)
1256
+ elif isinstance(mesh_or_pc, trimesh.PointCloud):
1257
+ if mesh_or_pc.colors is not None and len(mesh_or_pc.colors) > 0:
1258
+ return np.array(mesh_or_pc.colors[:, :3], dtype=np.uint8)
1259
+ except Exception as e:
1260
+ print(f" [WARN] 提取颜色失败: {e}")
1261
+ return None
1262
+
1263
+
1264
+ def save_pose(cam_pos_yup: list, cam_rot_euler: list,
1265
+ output_path: str, frame_id: int):
1266
+ """保存位姿 JSON(ERPT 格式,Y-up 坐标系,cam_to_world)
1267
+
1268
+ cam_pos_yup: [x, y, z],Y-up 世界坐标(已是 ERPT_native)
1269
+ cam_rot_euler: [rx, ry, rz] 弧度,XYZ 顺序
1270
+ """
1271
+ R_cw = _euler_to_rotation_matrix(*cam_rot_euler)
1272
+
1273
+ # 旋转矩阵 → 四元数(XYZW 顺序,转为 WXYZ)
1274
+ # Shepperd 方法
1275
+ m = R_cw
1276
+ t = m[0, 0] + m[1, 1] + m[2, 2]
1277
+ if t > 0:
1278
+ s = 0.5 / math.sqrt(t + 1.0)
1279
+ w = 0.25 / s
1280
+ x = (m[2, 1] - m[1, 2]) * s
1281
+ y = (m[0, 2] - m[2, 0]) * s
1282
+ z = (m[1, 0] - m[0, 1]) * s
1283
+ elif m[0, 0] > m[1, 1] and m[0, 0] > m[2, 2]:
1284
+ s = 2.0 * math.sqrt(1.0 + m[0, 0] - m[1, 1] - m[2, 2])
1285
+ w = (m[2, 1] - m[1, 2]) / s
1286
+ x = 0.25 * s
1287
+ y = (m[0, 1] + m[1, 0]) / s
1288
+ z = (m[0, 2] + m[2, 0]) / s
1289
+ elif m[1, 1] > m[2, 2]:
1290
+ s = 2.0 * math.sqrt(1.0 + m[1, 1] - m[0, 0] - m[2, 2])
1291
+ w = (m[0, 2] - m[2, 0]) / s
1292
+ x = (m[0, 1] + m[1, 0]) / s
1293
+ y = 0.25 * s
1294
+ z = (m[1, 2] + m[2, 1]) / s
1295
+ else:
1296
+ s = 2.0 * math.sqrt(1.0 + m[2, 2] - m[0, 0] - m[1, 1])
1297
+ w = (m[1, 0] - m[0, 1]) / s
1298
+ x = (m[0, 2] + m[2, 0]) / s
1299
+ y = (m[1, 2] + m[2, 1]) / s
1300
+ z = 0.25 * s
1301
+
1302
+ pose_data = {
1303
+ "frame_id": frame_id,
1304
+ "position": [float(v) for v in cam_pos_yup],
1305
+ "rotation_quaternion": [float(w), float(x), float(y), float(z)],
1306
+ "camera_type": "erp_ray",
1307
+ "coordinate_system": "right-handed, Y-up, Z-forward (cam_to_world)",
1308
+ "render_method": "ply_erp",
1309
+ }
1310
+ with open(output_path, 'w') as f:
1311
+ json.dump(pose_data, f, indent=2)
1312
+
1313
+
1314
+ def build_ray_directions(H=WARP_H, W=WARP_W):
1315
+ """ERP 射线方向(Y-up 坐标系)"""
1316
+ i = np.arange(H, dtype=np.float64)
1317
+ j = np.arange(W, dtype=np.float64)
1318
+ lat = np.pi / 2 - np.pi * (i + 0.5) / H # [-π/2, π/2]
1319
+ lon = 2 * np.pi * (j + 0.5) / W # [0, 2π]
1320
+ lat, lon = np.meshgrid(lat, lon, indexing='ij')
1321
+ r_xz = np.cos(lat)
1322
+ return np.stack([
1323
+ r_xz * np.sin(lon), # X
1324
+ np.sin(lat), # Y (up)
1325
+ r_xz * np.cos(lon), # Z (front)
1326
+ ], axis=-1)
1327
+
1328
+
1329
+ _ray_dirs_cache = {}
1330
+
1331
+
1332
+ def get_ray_dirs(H=WARP_H, W=WARP_W):
1333
+ if (H, W) not in _ray_dirs_cache:
1334
+ _ray_dirs_cache[(H, W)] = build_ray_directions(H, W)
1335
+ return _ray_dirs_cache[(H, W)]
1336
+
1337
+
1338
+ def depth_to_3d_points(position, depth, ray_dirs, max_depth=None):
1339
+ valid = depth > 0
1340
+ if max_depth is not None:
1341
+ valid &= (depth <= max_depth)
1342
+ if not np.any(valid):
1343
+ return np.empty((0, 3), dtype=np.float64)
1344
+ pos = np.array(position, dtype=np.float64)
1345
+ return (pos + ray_dirs * depth[..., np.newaxis])[valid]
1346
+
1347
+
1348
+ def project_points_to_coverage(pts, tgt_pos, H=WARP_H, W=WARP_W):
1349
+ if len(pts) == 0:
1350
+ return np.zeros((H, W), dtype=bool)
1351
+ tgt = np.array(tgt_pos, dtype=np.float64)
1352
+ vecs = pts - tgt
1353
+ x, y, z = vecs[:, 0], vecs[:, 1], vecs[:, 2]
1354
+ r_xz = np.sqrt(x ** 2 + z ** 2)
1355
+ lat = np.arctan2(y, r_xz)
1356
+ lon = np.arctan2(x, z) % (2 * np.pi)
1357
+ vi = np.clip(((np.pi / 2 - lat) / np.pi * H).astype(np.int32), 0, H - 1)
1358
+ uj = np.clip((lon / (2 * np.pi) * W).astype(np.int32), 0, W - 1)
1359
+ cov = np.zeros((H, W), dtype=bool)
1360
+ cov[vi, uj] = True
1361
+ pad = cov.copy()
1362
+ pad[1:, :] |= cov[:-1, :]
1363
+ pad[:-1, :] |= cov[1:, :]
1364
+ pad[:, 1:] |= cov[:, :-1]
1365
+ pad[:, :-1] |= cov[:, 1:]
1366
+ return pad
1367
+
1368
+
1369
+ def select_next_frame(candidates, selected_idx, selected_pos, all_pts,
1370
+ reachable=None):
1371
+ n = len(candidates)
1372
+ H, W = WARP_H, WARP_W
1373
+ total_px = H * W
1374
+ overlap_penalty = DEFAULT_OVERLAP_PENALTY
1375
+
1376
+ remaining = []
1377
+ for i in range(n):
1378
+ if i in selected_idx:
1379
+ continue
1380
+ if reachable is not None and i not in reachable:
1381
+ continue
1382
+ remaining.append(i)
1383
+
1384
+ if not remaining:
1385
+ return -1, 0.0, -999.0, 0
1386
+
1387
+ scores = {}
1388
+ for ci in remaining:
1389
+ cov = project_points_to_coverage(all_pts, candidates[ci], H, W)
1390
+ covered = int(np.sum(cov))
1391
+ new_r = (total_px - covered) / total_px
1392
+ ovl_r = covered / total_px
1393
+ scores[ci] = {
1394
+ "gain": new_r,
1395
+ "overlap": ovl_r,
1396
+ "score": new_r - overlap_penalty * ovl_r,
1397
+ }
1398
+
1399
+ best_ci, best_sc, best_g = -1, -999.0, 0.0
1400
+ for ci in remaining:
1401
+ if scores[ci]["score"] > best_sc:
1402
+ best_sc = scores[ci]["score"]
1403
+ best_ci = ci
1404
+ best_g = scores[ci]["gain"]
1405
+
1406
+ return best_ci, best_g, best_sc, len(remaining)
1407
+
1408
+
1409
+ def compute_max_depth(candidates):
1410
+ pos_arr = np.array(candidates)
1411
+ diag = float(np.linalg.norm(pos_arr.max(0) - pos_arr.min(0)))
1412
+ return diag * 1.5
1413
+
1414
+
1415
+ def load_depth_downsampled(path, H=WARP_H, W=WARP_W):
1416
+ d = np.load(path).astype(np.float32)
1417
+ d = np.nan_to_num(d, nan=0.0)
1418
+ if d.shape == (H, W):
1419
+ return d
1420
+ try:
1421
+ return cv2.resize(d, (W, H), interpolation=cv2.INTER_AREA)
1422
+ except Exception:
1423
+ h, w = d.shape
1424
+ bh, bw = h // H, w // W
1425
+ if bh < 1 or bw < 1:
1426
+ r = np.zeros((H, W), dtype=np.float32)
1427
+ r[:min(h, H), :min(w, W)] = d[:min(h, H), :min(w, W)]
1428
+ return r
1429
+ return d[:bh * H, :bw * W].reshape(H, bh, W, bw).mean(axis=(1, 3))
1430
+
1431
+
1432
+ def trim_depth(new_depth, new_pos, existing_pts, ray_dirs):
1433
+ n_orig = int(np.sum(new_depth > 0))
1434
+ if len(existing_pts) == 0:
1435
+ return new_depth.copy(), n_orig, n_orig
1436
+ cov = project_points_to_coverage(existing_pts, new_pos,
1437
+ new_depth.shape[0], new_depth.shape[1])
1438
+ trimmed = new_depth.copy()
1439
+ trimmed[cov] = 0
1440
+ return trimmed, n_orig, int(np.sum(trimmed > 0))
1441
+
1442
+
1443
+ def update_reachability(current_pos: np.ndarray, candidates, selected_idx,
1444
+ reachable: set, raycaster: RayCaster):
1445
+ """从当前位置出发,检测哪些候选点可达(无遮挡直线视线)"""
1446
+ if raycaster._intersector is None:
1447
+ # 非 Mesh:所有候选都"可达"
1448
+ for ci, c in enumerate(candidates):
1449
+ if ci not in selected_idx:
1450
+ reachable.add(ci)
1451
+ return 0
1452
+
1453
+ n_new = 0
1454
+ for ci, cand in enumerate(candidates):
1455
+ if ci in selected_idx or ci in reachable:
1456
+ continue
1457
+ target = np.array(cand, dtype=np.float64)
1458
+ dist_to_target = float(np.linalg.norm(target - current_pos))
1459
+ if dist_to_target < 0.1:
1460
+ reachable.add(ci)
1461
+ n_new += 1
1462
+ continue
1463
+ direction = (target - current_pos) / dist_to_target
1464
+ hit, hit_dist = raycaster.cast_ray(current_pos, direction)
1465
+ if not hit or hit_dist >= dist_to_target * 0.95:
1466
+ reachable.add(ci)
1467
+ n_new += 1
1468
+
1469
+ return n_new
1470
+
1471
+
1472
+ def run_phase2(pts_world: np.ndarray,
1473
+ colors_world,
1474
+ faces,
1475
+ candidates,
1476
+ mesh_center,
1477
+ raycaster: RayCaster,
1478
+ output_dir: str,
1479
+ max_frames: int,
1480
+ resolution,
1481
+ args):
1482
+ """边选帧边渲染主循环(PLY 版本,逻辑与 Blender 版本对齐)"""
1483
+ W_render, H_render = resolution
1484
+ ray_dirs = get_ray_dirs(WARP_H, WARP_W)
1485
+ max_depth = compute_max_depth(candidates)
1486
+
1487
+ selected_idx = set()
1488
+ selected_pos = []
1489
+ all_pts = np.empty((0, 3), dtype=np.float64)
1490
+ pts_chunks = []
1491
+ results = []
1492
+ reachable = set()
1493
+
1494
+ stop_score = args.stop_score
1495
+ stop_delta = args.stop_delta
1496
+ min_frames = args.min_frames
1497
+
1498
+ ACTUAL_GAIN_WINDOW = 3
1499
+ ACTUAL_GAIN_FLOOR = args.stop_gain
1500
+ actual_gain_history = []
1501
+ delta_history = []
1502
+
1503
+ # ── 异步 I/O 线程池:写盘与 GPU 渲染并行 ─────────────────────────────
1504
+ _io_executor = ThreadPoolExecutor(max_workers=2)
1505
+ _pending_io = [] # list of Future,用于等待上一帧写盘完成
1506
+
1507
+ def _save_frame_async(rgb, depth, rgb_path, depth_npy, pos, cam_rot,
1508
+ pose_path, frame_id):
1509
+ """在线程池中异步保存 PNG + npy + json"""
1510
+ def _do_save():
1511
+ cv2.imwrite(rgb_path, cv2.cvtColor(rgb, cv2.COLOR_RGB2BGR))
1512
+ np.save(depth_npy, depth.astype(np.float32))
1513
+ save_pose(pos, cam_rot, pose_path, frame_id)
1514
+ return _io_executor.submit(_do_save)
1515
+ consecutive_skips = 0
1516
+ MAX_CONSECUTIVE_SKIPS = 3
1517
+
1518
+ # 楼层分组(按 Y 坐标聚类)
1519
+ y_vals = sorted(set(round(c[1], 2) for c in candidates))
1520
+ floors = [[y_vals[0]]]
1521
+ for y in y_vals[1:]:
1522
+ if y - floors[-1][-1] > 1.0:
1523
+ floors.append([y])
1524
+ else:
1525
+ floors[-1].append(y)
1526
+
1527
+ n_floors = len(floors)
1528
+ floor_mids = [sum(f) / len(f) for f in floors]
1529
+ candidate_floor = [
1530
+ min(range(n_floors), key=lambda i: abs(c[1] - floor_mids[i]))
1531
+ for c in candidates
1532
+ ]
1533
+ current_floor = 0
1534
+
1535
+ def floor_set(fi):
1536
+ return set(i for i, f in enumerate(candidate_floor) if f == fi)
1537
+
1538
+ floor_names = [f"楼层{i+1}(Y={min(f):.1f}~{max(f):.1f})" for i, f in enumerate(floors)]
1539
+
1540
+ print(f"\n{'='*60}")
1541
+ print(f"[Phase 2] 边渲边选 (候选={len(candidates)}, 最多={max_frames}帧)")
1542
+ print(f"{'='*60}")
1543
+ print(f" {n_floors} 个楼层: {floor_names}")
1544
+
1545
+ t_total = time.time()
1546
+ time_select = time_render = time_depth = time_reach = 0.0
1547
+
1548
+ for frame_count in range(max_frames):
1549
+
1550
+ # ---- 选位置 ----
1551
+ t_sel = time.time()
1552
+ if frame_count == 0:
1553
+ floor0_cands = [(i, c) for i, c in enumerate(candidates)
1554
+ if candidate_floor[i] == 0]
1555
+ if floor0_cands:
1556
+ f0_pts = np.array([c for _, c in floor0_cands])
1557
+ xz_center = np.array([f0_pts[:, 0].mean(), f0_pts[:, 2].mean()])
1558
+ floor0_ys = sorted(set(c[1] for _, c in floor0_cands))
1559
+ y_target = min(floor0_ys) + 1.2
1560
+ target = np.array([xz_center[0], y_target, xz_center[1]])
1561
+ dists = [np.linalg.norm(np.array(c) - target)
1562
+ for _, c in floor0_cands]
1563
+ ci = floor0_cands[int(np.argmin(dists))][0]
1564
+ else:
1565
+ mc = np.array(mesh_center, dtype=np.float64)
1566
+ ci = int(np.argmin([np.linalg.norm(np.array(c) - mc)
1567
+ for c in candidates]))
1568
+ gain, score = 1.0, 1.0
1569
+ print(f"\n F{frame_count}: 选候选[{ci}] (楼层中心, Y={candidates[ci][1]:.2f}m) "
1570
+ f"[{floor_names[current_floor]}]")
1571
+ else:
1572
+ cur_floor_ids = floor_set(current_floor)
1573
+ floor_reachable = reachable & cur_floor_ids if reachable else set()
1574
+
1575
+ ci, gain, score, n_remain = select_next_frame(
1576
+ candidates, selected_idx, selected_pos, all_pts,
1577
+ reachable=floor_reachable if floor_reachable else cur_floor_ids)
1578
+
1579
+ expand = False
1580
+ if ci < 0 or score < stop_score:
1581
+ ci2, gain2, score2, n2 = select_next_frame(
1582
+ candidates, selected_idx, selected_pos, all_pts,
1583
+ reachable=cur_floor_ids)
1584
+ if ci2 >= 0 and (ci < 0 or score2 > score):
1585
+ ci, gain, score, n_remain = ci2, gain2, score2, n2
1586
+ expand = True
1587
+
1588
+ if ci < 0 or (score < stop_score and gain < ACTUAL_GAIN_FLOOR):
1589
+ reason = "无可选候选" if ci < 0 else f"gain={gain:.1%} score={score:.3f}"
1590
+ current_floor += 1
1591
+ if current_floor < n_floors:
1592
+ print(f"\n F{frame_count}: {reason}"
1593
+ f" → 切换到 {floor_names[current_floor]}")
1594
+ continue
1595
+ else:
1596
+ print(f"\n F{frame_count}: {reason} → 所有楼层拍满,停止")
1597
+ break
1598
+
1599
+ tag = "[扩展]" if expand else ""
1600
+ print(f"\n F{frame_count}: 选候选[{ci}] "
1601
+ f"gain={gain:.1%} score={score:.3f} 剩余={n_remain}"
1602
+ f" [Y={candidates[ci][1]:.2f} {floor_names[current_floor]}]{tag}")
1603
+
1604
+ pos = candidates[ci]
1605
+ selected_idx.add(ci)
1606
+ selected_pos.append(pos)
1607
+ dt_sel = time.time() - t_sel
1608
+ time_select += dt_sel
1609
+
1610
+ # ---- 渲染(GPU 共享场景数据,减少重复上传)----
1611
+ cam_rot = get_camera_rot(args.rotation_type, frame_count)
1612
+ base = f"panorama_{frame_count:04d}"
1613
+ rgb_path = os.path.join(output_dir, f"{base}.png")
1614
+ depth_npy = os.path.join(output_dir, f"{base}_depth.npy")
1615
+ pose_path = os.path.join(output_dir, f"pose_{frame_count:04d}.json")
1616
+
1617
+ print(f" 位置: [{pos[0]:.2f}, {pos[1]:.2f}, {pos[2]:.2f}]")
1618
+ print(f" 渲染...", end="", flush=True)
1619
+ t_r = time.time()
1620
+
1621
+ # 等待上一帧异步 I/O 完成(保证不超过 2 帧待写)
1622
+ while len(_pending_io) >= 2:
1623
+ _pending_io.pop(0).result()
1624
+
1625
+ # 使用 render_erp_batch_gpu:场景数据只上传一次
1626
+ batch_results = render_erp_batch_gpu(
1627
+ pts_world, colors_world,
1628
+ cam_poses=[pos],
1629
+ cam_rots=[cam_rot],
1630
+ width=W_render,
1631
+ height=H_render,
1632
+ faces=faces,
1633
+ point_size=args.point_size,
1634
+ )
1635
+ rgb, depth = batch_results[0]
1636
+
1637
+ # 异步写盘(与下一帧 GPU 渲染并行)
1638
+ fut = _save_frame_async(
1639
+ rgb, depth, rgb_path, depth_npy,
1640
+ pos, cam_rot, pose_path, frame_count)
1641
+ _pending_io.append(fut)
1642
+
1643
+ dt_r = time.time() - t_r
1644
+ time_render += dt_r
1645
+ print(f" {dt_r:.1f}s")
1646
+
1647
+ # ---- depth → 3D 点云 ----
1648
+ t_dep = time.time()
1649
+ actual_gain = 1.0
1650
+ delta_ratio = 1.0
1651
+
1652
+ # 直接使用内存中的 depth(depth_npy 由异步线程写入,可能尚未落盘)
1653
+ _d = depth.astype(np.float32)
1654
+ _d = np.nan_to_num(_d, nan=0.0)
1655
+ if _d.shape == (WARP_H, WARP_W):
1656
+ depth_small = _d
1657
+ else:
1658
+ try:
1659
+ depth_small = cv2.resize(_d, (WARP_W, WARP_H), interpolation=cv2.INTER_AREA)
1660
+ except Exception:
1661
+ h, w = _d.shape
1662
+ bh, bw = h // WARP_H, w // WARP_W
1663
+ if bh < 1 or bw < 1:
1664
+ depth_small = np.zeros((WARP_H, WARP_W), dtype=np.float32)
1665
+ depth_small[:min(h, WARP_H), :min(w, WARP_W)] = _d[:min(h, WARP_H), :min(w, WARP_W)]
1666
+ else:
1667
+ depth_small = _d[:bh*WARP_H, :bw*WARP_W].reshape(WARP_H, bh, WARP_W, bw).mean(axis=(1, 3))
1668
+ total_px = WARP_H * WARP_W
1669
+ n_valid = int(np.sum(depth_small > 0))
1670
+ valid_ratio = n_valid / total_px
1671
+
1672
+ if frame_count == 0:
1673
+ new_pts = depth_to_3d_points(pos, depth_small, ray_dirs, max_depth)
1674
+ pts_chunks.append(new_pts)
1675
+ all_pts = new_pts
1676
+ actual_gain = valid_ratio
1677
+ print(f" depth: {n_valid}px ({valid_ratio:.0%} 有效)"
1678
+ f" → {len(new_pts)} 个 3D 点 (全部)")
1679
+ else:
1680
+ MIN_VALID_RATIO = 0.10 # PLY 点云空洞较多,阈值适当降低
1681
+ if valid_ratio < MIN_VALID_RATIO:
1682
+ print(f" depth: {n_valid}px ({valid_ratio:.0%} 有效) < "
1683
+ f"{MIN_VALID_RATIO:.0%} → 跳过此帧")
1684
+ results.append({
1685
+ "frame_id": frame_count,
1686
+ "candidate_idx": ci,
1687
+ "position": pos,
1688
+ "gain": float(gain),
1689
+ "actual_gain": 0.0,
1690
+ "delta_ratio": 0.0,
1691
+ "score": float(score),
1692
+ "skipped": True,
1693
+ "skip_reason": f"valid_ratio={valid_ratio:.1%}",
1694
+ })
1695
+ for fp in [rgb_path, depth_npy]:
1696
+ if os.path.exists(fp):
1697
+ try:
1698
+ os.remove(fp)
1699
+ except OSError:
1700
+ pass
1701
+ consecutive_skips += 1
1702
+ if consecutive_skips >= MAX_CONSECUTIVE_SKIPS:
1703
+ current_floor += 1
1704
+ consecutive_skips = 0
1705
+ if current_floor < n_floors:
1706
+ print(f" 连续 {MAX_CONSECUTIVE_SKIPS} 帧空洞"
1707
+ f" → 切换到 {floor_names[current_floor]}")
1708
+ else:
1709
+ print(f" 连续 {MAX_CONSECUTIVE_SKIPS} 帧空洞,停止")
1710
+ break
1711
+ time_depth += time.time() - t_dep
1712
+ continue
1713
+
1714
+ trimmed, n_orig, n_new = trim_depth(depth_small, pos, all_pts, ray_dirs)
1715
+ new_pts = depth_to_3d_points(pos, trimmed, ray_dirs, max_depth)
1716
+ pts_chunks.append(new_pts)
1717
+ all_pts = np.concatenate(pts_chunks)
1718
+ actual_gain = n_new / total_px
1719
+ delta_ratio = len(new_pts) / len(all_pts) if len(all_pts) > 0 else 1.0
1720
+ print(f" depth: {n_valid}px ({valid_ratio:.0%} 有效)"
1721
+ f" → trim → {n_new}px 新增 → {len(new_pts)} 个新 3D 点")
1722
+ print(f" 累积点云: {len(all_pts)}, 实际gain: {actual_gain:.1%}")
1723
+ consecutive_skips = 0
1724
+
1725
+ time_depth += time.time() - t_dep
1726
+
1727
+ results.append({
1728
+ "frame_id": frame_count,
1729
+ "candidate_idx": ci,
1730
+ "position": pos,
1731
+ "gain": float(gain),
1732
+ "actual_gain": float(actual_gain),
1733
+ "delta_ratio": float(delta_ratio),
1734
+ "score": float(score),
1735
+ })
1736
+
1737
+ # ---- 可达性更新 ----
1738
+ t_reach = time.time()
1739
+ n_new_r = update_reachability(
1740
+ np.array(pos), candidates, selected_idx, reachable, raycaster)
1741
+ dt_reach = time.time() - t_reach
1742
+ time_reach += dt_reach
1743
+ print(f" [可达性] 新增 {n_new_r} 个,总 {len(reachable)}/{len(candidates)} "
1744
+ f"({dt_reach:.1f}s)")
1745
+
1746
+ # ---- 停止条件 ----
1747
+ if frame_count > 0:
1748
+ actual_gain_history.append(actual_gain)
1749
+ delta_history.append(delta_ratio)
1750
+
1751
+ if frame_count > 0 and frame_count >= min_frames:
1752
+ if len(actual_gain_history) >= ACTUAL_GAIN_WINDOW:
1753
+ recent_gain = actual_gain_history[-ACTUAL_GAIN_WINDOW:]
1754
+ recent_delta = delta_history[-ACTUAL_GAIN_WINDOW:]
1755
+ gain_exhausted = all(g < ACTUAL_GAIN_FLOOR for g in recent_gain)
1756
+ delta_exhausted = all(d < stop_delta for d in recent_delta)
1757
+
1758
+ if gain_exhausted or delta_exhausted:
1759
+ current_floor += 1
1760
+ if current_floor < n_floors:
1761
+ reason = (f"gain<{ACTUAL_GAIN_FLOOR:.0%}" if gain_exhausted
1762
+ else f"delta<{stop_delta:.0%}")
1763
+ print(f" 连续 {ACTUAL_GAIN_WINDOW} 帧 {reason}"
1764
+ f" → 切换到 {floor_names[current_floor]}")
1765
+ else:
1766
+ print(f" 所有楼层拍满,停止")
1767
+ break
1768
+
1769
+ # 补帧:确保 4n+1
1770
+ while len(results) > 1 and (len(results) - 1) % 4 != 0:
1771
+ frame_count = results[-1]["frame_id"] + 1
1772
+ if frame_count >= max_frames + 3:
1773
+ break
1774
+ print(f"\n [补帧] 当前 {len(results)} 帧,需补至 4n+1")
1775
+ ci, gain, score, n_remain = select_next_frame(
1776
+ candidates, selected_idx, selected_pos, all_pts, reachable=None)
1777
+ if ci < 0:
1778
+ break
1779
+
1780
+ pos = candidates[ci]
1781
+ selected_idx.add(ci)
1782
+ selected_pos.append(pos)
1783
+
1784
+ cam_rot = get_camera_rot(args.rotation_type, frame_count)
1785
+ base = f"panorama_{frame_count:04d}"
1786
+ rgb_path = os.path.join(output_dir, f"{base}.png")
1787
+ depth_npy = os.path.join(output_dir, f"{base}_depth.npy")
1788
+
1789
+ batch_res = render_erp_batch_gpu(
1790
+ pts_world, colors_world,
1791
+ cam_poses=[pos], cam_rots=[cam_rot],
1792
+ width=W_render, height=H_render,
1793
+ faces=faces, point_size=args.point_size,
1794
+ )
1795
+ rgb, depth = batch_res[0]
1796
+ try:
1797
+ cv2.imwrite(rgb_path, cv2.cvtColor(rgb, cv2.COLOR_RGB2BGR))
1798
+ except Exception:
1799
+ from PIL import Image
1800
+ Image.fromarray(rgb).save(rgb_path)
1801
+ np.save(depth_npy, depth.astype(np.float32))
1802
+ save_pose(pos, cam_rot, os.path.join(output_dir, f"pose_{frame_count:04d}.json"),
1803
+ frame_count)
1804
+
1805
+ depth_small = load_depth_downsampled(depth_npy, WARP_H, WARP_W)
1806
+ trimmed, n_orig, n_new = trim_depth(depth_small, pos, all_pts, ray_dirs)
1807
+ new_pts = depth_to_3d_points(pos, trimmed, ray_dirs, max_depth)
1808
+ pts_chunks.append(new_pts)
1809
+ all_pts = np.concatenate(pts_chunks)
1810
+ actual_gain = n_new / total_px
1811
+ results.append({
1812
+ "frame_id": frame_count,
1813
+ "candidate_idx": ci,
1814
+ "position": pos,
1815
+ "gain": float(gain),
1816
+ "actual_gain": float(actual_gain),
1817
+ "delta_ratio": float(len(new_pts) / max(len(all_pts), 1)),
1818
+ "score": float(score),
1819
+ "supplementary": True,
1820
+ })
1821
+ print(f" 补帧 F{frame_count}: gain={actual_gain:.1%}")
1822
+
1823
+ # ── 等待所有异步 I/O 完成,关闭线程池 ────────────────────────────────
1824
+ for fut in _pending_io:
1825
+ try:
1826
+ fut.result()
1827
+ except Exception as e:
1828
+ print(f" [WARN] 异步写盘失败: {e}")
1829
+ _io_executor.shutdown(wait=False)
1830
+
1831
+ dt = time.time() - t_total
1832
+ print(f"\n {'─'*50}")
1833
+ print(f" 共 {len(results)} 帧, {dt:.1f}s ({dt/60:.1f}min)")
1834
+ print(f" 耗时: 选帧={time_select:.1f}s 渲染={time_render:.1f}s "
1835
+ f"深度={time_depth:.1f}s 可达={time_reach:.1f}s")
1836
+ return results
1837
+
1838
+
1839
+ def main():
1840
+ args = parse_args()
1841
+
1842
+ ply_path = str(Path(args.ply).resolve())
1843
+ output_dir = str(Path(args.output_dir).resolve())
1844
+ resolution = tuple(int(x) for x in args.resolution.split(","))
1845
+ os.makedirs(output_dir, exist_ok=True)
1846
+ sel_dir = os.path.join(output_dir, "frame_selection")
1847
+ os.makedirs(sel_dir, exist_ok=True)
1848
+
1849
+ print("=" * 60)
1850
+ print("ERPT PLY Pipeline(边渲边选)")
1851
+ print("=" * 60)
1852
+ print(f" PLY: {ply_path}")
1853
+ print(f" Output: {output_dir}")
1854
+ print(f" Max frames: {args.num_frames}")
1855
+ print(f" Resolution: {resolution[0]}x{resolution[1]}")
1856
+ t_start = time.time()
1857
+
1858
+ # ===== Phase 0: 加载场景 =====
1859
+ mesh_obj, pts_world, bmin, bmax, is_mesh, faces = load_ply_scene(
1860
+ ply_path, z_up=args.z_up)
1861
+
1862
+ # 提取颜色
1863
+ colors_world = _extract_ply_colors(mesh_obj)
1864
+ if colors_world is not None:
1865
+ print(f" 颜色: {len(colors_world)} 个顶点颜色")
1866
+ else:
1867
+ print(f" 颜色: 无顶点颜色,使用深度伪彩")
1868
+
1869
+ # 构建射线检测器
1870
+ raycaster = RayCaster(mesh_obj, pts_world, bmin, bmax, is_mesh, z_up=args.z_up)
1871
+
1872
+ # ===== Phase 1: 撒点 + 过滤 =====
1873
+ print(f"\n{'='*60}")
1874
+ print("[Phase 1] 多层撒点 + 7 层过滤")
1875
+ print(f"{'='*60}")
1876
+
1877
+ # Y-up 坐标系:Y=高度,floor=bmin[1],ceiling=bmax[1]
1878
+ floor_y = float(bmin[1])
1879
+ ceiling_y = float(bmax[1])
1880
+ print(f" 场景 Y 范围: {floor_y:.2f} ~ {ceiling_y:.2f}m (总高 {ceiling_y-floor_y:.2f}m)")
1881
+
1882
+ heights = compute_camera_heights(floor_y, ceiling_y, args.camera_height)
1883
+ print(f" 相机高度层: {[f'{h:.2f}m' for h in heights]}")
1884
+
1885
+ x_range = float(bmax[0] - bmin[0])
1886
+ z_range = float(bmax[2] - bmin[2])
1887
+ x_sp = args.grid_spacing
1888
+ z_sp = args.grid_spacing
1889
+
1890
+ # 候选点过多时自适应增大间距
1891
+ n_xy = max(1, int((x_range - 2 * MARGIN) / x_sp)) * \
1892
+ max(1, int((z_range - 2 * MARGIN) / z_sp))
1893
+ total_est = n_xy * len(heights)
1894
+ if total_est > 10000:
1895
+ scale = math.sqrt(total_est / 10000)
1896
+ x_sp = min(x_sp * scale, x_range / 4)
1897
+ z_sp = min(z_sp * scale, z_range / 4)
1898
+ print(f" [自适应] 候选≈{total_est}个,间距调整为 X={x_sp:.1f}m Z={z_sp:.1f}m")
1899
+
1900
+ candidates = generate_candidate_grid(bmin, bmax, x_sp, z_sp, heights)
1901
+ if not candidates:
1902
+ print(" [Error] 没有候选点")
1903
+ sys.exit(1)
1904
+
1905
+ room_height = ceiling_y - floor_y
1906
+ candidates = raycast_filter(candidates, raycaster, room_height)
1907
+ if not candidates:
1908
+ print(" [Warning] 全部被过滤,使用 AABB 中心")
1909
+ cx = float((bmin[0] + bmax[0]) / 2)
1910
+ cy = float(heights[0])
1911
+ cz = float((bmin[2] + bmax[2]) / 2)
1912
+ candidates = [[cx, cy, cz]]
1913
+
1914
+ np.save(os.path.join(sel_dir, "candidates_filtered.npy"),
1915
+ np.array(candidates))
1916
+ print(f" 最终候选点: {len(candidates)} 个")
1917
+
1918
+ mesh_center = [
1919
+ float((bmin[0] + bmax[0]) / 2),
1920
+ float((bmin[1] + bmax[1]) / 2),
1921
+ float((bmin[2] + bmax[2]) / 2),
1922
+ ]
1923
+
1924
+ # ===== Phase 2: 边渲边选 =====
1925
+ results = run_phase2(
1926
+ pts_world=pts_world,
1927
+ colors_world=colors_world,
1928
+ faces=faces,
1929
+ candidates=candidates,
1930
+ mesh_center=mesh_center,
1931
+ raycaster=raycaster,
1932
+ output_dir=output_dir,
1933
+ max_frames=args.num_frames,
1934
+ resolution=resolution,
1935
+ args=args,
1936
+ )
1937
+
1938
+ # ===== 保存选帧摘要 =====
1939
+ summary = {
1940
+ "scene": os.path.basename(ply_path),
1941
+ "total_frames": len(results),
1942
+ "candidates_count": len(candidates),
1943
+ "frames": [{
1944
+ "frame_id": r["frame_id"],
1945
+ "position": r["position"],
1946
+ "gain": r["gain"],
1947
+ "actual_gain": r["actual_gain"],
1948
+ "delta_ratio": r["delta_ratio"],
1949
+ "score": r["score"],
1950
+ } for r in results if not r.get("skipped")],
1951
+ }
1952
+ with open(os.path.join(sel_dir, "selected_frames.json"), "w") as f:
1953
+ json.dump(summary, f, indent=2, ensure_ascii=False)
1954
+
1955
+ dt = time.time() - t_start
1956
+ print(f"\n{'='*60}")
1957
+ print(f"完成! {len(results)} 帧, {dt:.1f}s ({dt/60:.1f}min)")
1958
+ print(f"{'='*60}")
1959
+ print(f"输出目录: {output_dir}/")
1960
+ for r in results:
1961
+ if not r.get("skipped"):
1962
+ fid = r["frame_id"]
1963
+ print(f" panorama_{fid:04d}.png + _depth.npy + pose_{fid:04d}.json")
1964
+
1965
+
1966
+ if __name__ == "__main__":
1967
+ main()
adapters/tartanground/README.md ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # TartanGround adapter — CM-EVS (re-encoding only)
2
+
3
+ TartanGround is the outdoor source providing the largest depth dynamic range in CM-EVS. Like OB3D, this adapter only **re-encodes** upstream cubemap trajectories into the unified ERP + world-to-camera pose schema. The curator does **not** run on TartanGround in v1.0.
4
+
5
+ > **License notice**: TartanGround / TartanAir typically ships under licenses (e.g. CC-BY-NC-SA) that **forbid redistribution of derived RGB-D frames**. This adapter package therefore contains zero TartanGround-derived imagery — only the re-encoding script + the list of trajectory IDs the paper runs over. See `../../LICENSE.md`.
6
+
7
+ ## Files
8
+
9
+ - `config.yaml` — re-encoding parameters. Some fields are **placeholders** to be finalized; see `../../TODO.md`.
10
+ - `reencoding_script.md` — exact command + expected upstream layout (cubemap face directories, depth as 1-of-10 frames, pose CSV / JSON format) + output schema.
11
+ - `metadata/source_manifest.json` — list of 762 trajectory parts the paper's evaluation runs over. Note: paper §4.3 Table 4 reports the target as "63 environments / 783,944 frames"; the H100-side data CM-EVS was developed against currently has **11 environments / 762 parts**, with the remaining environments held offline. The full target will be reached as the upstream coverage is expanded — see `../../TODO.md`.
12
+
13
+ ## Reproducing the paper's TartanGround frames
14
+
15
+ 1. Obtain TartanGround source data per its upstream license (typically academic-only, non-commercial).
16
+ 2. Place under `data/tartanground/<env_name>-Data_<diff|omni>-P<XXXX>-part<N>/...` matching the layout in `reencoding_script.md`.
17
+ 3. Run the re-encoder:
18
+ ```bash
19
+ cd ../../code
20
+ python scripts/reencode_outdoor.py --source tartanground --config ../adapters/tartanground/config.yaml
21
+ ```
22
+ 4. Outputs land in `outputs/tartanground/<env_name>-...-part<N>/{rgb, depth, pose}/...` under the unified schema.
23
+
24
+ ## What the re-encoding does
25
+
26
+ - **Cubemap → ERP** at the source's native resolution (2048×1024 per paper §4.3 Table 4).
27
+ - **Pose unification**: rewrite original axis convention into right-handed `+X`-right `+Y`-up `+Z`-forward world frame; pose stored as scalar-first `q_wc = [w, x, y, z]` plus position relative to trajectory first frame.
28
+ - **Trajectory partitioning**: each upstream trajectory is sliced into ~200-frame parts; the leftover partial part at the end is folded into the previous part. Part boundaries appear in the directory name as `part0, part1, …`.
29
+ - **Sparse depth**: TartanGround upstream ships depth on a 1-of-10 frame subsample. Depth NPYs only exist for those frames; for other frames `panorama_NNNN_depth.npy` is absent.
30
+
31
+ See paper §3.4 (Table 2 row "TartanGround") and §4.3 (Table 4 — outdoor / TartanGround row).
32
+
33
+ ## License
34
+
35
+ - This adapter code: **MIT**.
36
+ - Frames you produce by re-encoding TartanGround data: bound by the **upstream TartanGround / TartanAir license** (typically CC-BY-NC-SA or similar non-commercial). The MIT license on the adapter does **not** override upstream terms.
37
+ - The `metadata/source_manifest.json` itself lists trajectory IDs only; before redistributing or quoting it verbatim, check whether the upstream license permits sharing IDs.
adapters/tartanground/config.yaml ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # TartanGround outdoor re-encoding adapter — CM-EVS
2
+ #
3
+ # Placeholder reflecting paper §3.4 (Table 2 row "TartanGround"). Concrete
4
+ # parameters (cubemap face size, source axis convention, depth subsampling
5
+ # stride) are tracked in TODO.md and will be finalized before HF push.
6
+
7
+ experiment:
8
+ source: tartanground
9
+ input_kind: cubemap_dense_trajectory # TartanGround upstream ships dense cubemap
10
+
11
+ reencoding:
12
+ input_dir: data/tartanground
13
+ output_root: outputs/tartanground
14
+
15
+ # Source cubemap face size — TartanGround typically 1024×1024 per face. Confirm.
16
+ cubemap_face_size: TODO
17
+
18
+ # Final ERP resolution — paper §4.3 Table 4 lists TartanGround at 2048×1024.
19
+ erp_resolution: "2048,1024"
20
+
21
+ pose_format: world_to_camera_quaternion
22
+ source_axis_convention: TODO # confirm from TartanGround upstream
23
+ target_axis_convention: y-up_z-forward # CM-EVS world frame
24
+
25
+ depth_format: range
26
+ depth_unit: meters
27
+ invalid_marker: nan
28
+ # TartanGround upstream ships depth on a 1-of-10 frame subsample. The
29
+ # re-encoder respects this — depth NPYs only exist for the subsampled frames.
30
+ depth_subsample_stride: 10
31
+
32
+ # Trajectory slicing — TartanGround trajectories are long (often >2000 frames).
33
+ # The paper splits each trajectory into ~200-frame parts; leftover folds into
34
+ # the last part.
35
+ trajectory_partition: true
36
+ partition_size: 200
37
+
38
+ emit_meta_json: true
39
+ emit_per_step_log: false # curator does not run on outdoor in v1.0
40
+
41
+ # Source manifest (which trajectory parts to re-encode):
42
+ # see metadata/source_manifest.json (762 parts across 11 environments — paper
43
+ # target is 63 environments; remaining environments held offline)
adapters/tartanground/metadata/source_manifest.json ADDED
@@ -0,0 +1,800 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "source": "tartanground",
3
+ "label": "TartanGround",
4
+ "description": "Outdoor source. Re-encoding adapter only — no curator selection. H100 currently holds 11 environments / 762 trajectory parts; the paper target is 63 environments / 783,944 frames (remaining environments held offline).",
5
+ "license": "MIT (code) + per upstream TartanGround / TartanAir license (typically CC-BY-NC-SA)",
6
+ "release_policy": "frames produced by re-encoding remain under upstream license; non-commercial use only typical",
7
+ "id_field": "trajectory_part_id",
8
+ "id_count": 762,
9
+ "ids": [
10
+ "AbandonedCable-Data_diff-P1000-part1",
11
+ "AbandonedCable-Data_diff-P1000-part2",
12
+ "AbandonedCable-Data_diff-P1000-part3",
13
+ "AbandonedCable-Data_diff-P1001-part1",
14
+ "AbandonedCable-Data_diff-P1001-part2",
15
+ "AbandonedCable-Data_diff-P1001-part3",
16
+ "AbandonedCable-Data_diff-P1001-part4",
17
+ "AbandonedCable-Data_diff-P1002-part1",
18
+ "AbandonedCable-Data_diff-P1002-part2",
19
+ "AbandonedCable-Data_diff-P1002-part3",
20
+ "AbandonedCable-Data_diff-P1002-part4",
21
+ "AbandonedCable-Data_diff-P1002-part5",
22
+ "AbandonedCable-Data_diff-P1002-part6",
23
+ "AbandonedCable-Data_diff-P1002-part7",
24
+ "AbandonedCable-Data_diff-P1002-part8",
25
+ "AbandonedCable-Data_diff-P1003-part1",
26
+ "AbandonedCable-Data_diff-P1003-part10",
27
+ "AbandonedCable-Data_diff-P1003-part2",
28
+ "AbandonedCable-Data_diff-P1003-part3",
29
+ "AbandonedCable-Data_diff-P1003-part4",
30
+ "AbandonedCable-Data_diff-P1003-part5",
31
+ "AbandonedCable-Data_diff-P1003-part6",
32
+ "AbandonedCable-Data_diff-P1003-part7",
33
+ "AbandonedCable-Data_diff-P1003-part8",
34
+ "AbandonedCable-Data_diff-P1003-part9",
35
+ "AbandonedCable-Data_diff-P1004-part1",
36
+ "AbandonedCable-Data_diff-P1004-part10",
37
+ "AbandonedCable-Data_diff-P1004-part11",
38
+ "AbandonedCable-Data_diff-P1004-part12",
39
+ "AbandonedCable-Data_diff-P1004-part13",
40
+ "AbandonedCable-Data_diff-P1004-part14",
41
+ "AbandonedCable-Data_diff-P1004-part15",
42
+ "AbandonedCable-Data_diff-P1004-part16",
43
+ "AbandonedCable-Data_diff-P1004-part17",
44
+ "AbandonedCable-Data_diff-P1004-part18",
45
+ "AbandonedCable-Data_diff-P1004-part19",
46
+ "AbandonedCable-Data_diff-P1004-part2",
47
+ "AbandonedCable-Data_diff-P1004-part20",
48
+ "AbandonedCable-Data_diff-P1004-part21",
49
+ "AbandonedCable-Data_diff-P1004-part22",
50
+ "AbandonedCable-Data_diff-P1004-part3",
51
+ "AbandonedCable-Data_diff-P1004-part4",
52
+ "AbandonedCable-Data_diff-P1004-part5",
53
+ "AbandonedCable-Data_diff-P1004-part6",
54
+ "AbandonedCable-Data_diff-P1004-part7",
55
+ "AbandonedCable-Data_diff-P1004-part8",
56
+ "AbandonedCable-Data_diff-P1004-part9",
57
+ "AbandonedCable-Data_diff-P1005-part1",
58
+ "AbandonedCable-Data_diff-P1005-part2",
59
+ "AbandonedCable-Data_diff-P1005-part3",
60
+ "AbandonedCable-Data_diff-P1005-part4",
61
+ "AbandonedCable-Data_diff-P1005-part5",
62
+ "AbandonedCable-Data_diff-P1006-part1",
63
+ "AbandonedCable-Data_diff-P1006-part2",
64
+ "AbandonedCable-Data_diff-P1006-part3",
65
+ "AbandonedCable-Data_diff-P1006-part4",
66
+ "AbandonedCable-Data_diff-P1006-part5",
67
+ "AbandonedCable-Data_diff-P1007-part1",
68
+ "AbandonedCable-Data_diff-P1007-part10",
69
+ "AbandonedCable-Data_diff-P1007-part11",
70
+ "AbandonedCable-Data_diff-P1007-part12",
71
+ "AbandonedCable-Data_diff-P1007-part13",
72
+ "AbandonedCable-Data_diff-P1007-part14",
73
+ "AbandonedCable-Data_diff-P1007-part15",
74
+ "AbandonedCable-Data_diff-P1007-part16",
75
+ "AbandonedCable-Data_diff-P1007-part17",
76
+ "AbandonedCable-Data_diff-P1007-part18",
77
+ "AbandonedCable-Data_diff-P1007-part2",
78
+ "AbandonedCable-Data_diff-P1007-part3",
79
+ "AbandonedCable-Data_diff-P1007-part4",
80
+ "AbandonedCable-Data_diff-P1007-part5",
81
+ "AbandonedCable-Data_diff-P1007-part6",
82
+ "AbandonedCable-Data_diff-P1007-part7",
83
+ "AbandonedCable-Data_diff-P1007-part8",
84
+ "AbandonedCable-Data_diff-P1007-part9",
85
+ "AbandonedCable-Data_diff-P1008-part1",
86
+ "AbandonedCable-Data_diff-P1008-part2",
87
+ "AbandonedCable-Data_diff-P1008-part3",
88
+ "AbandonedCable-Data_diff-P1008-part4",
89
+ "AbandonedCable-Data_diff-P1009-part1",
90
+ "AbandonedCable-Data_diff-P1009-part2",
91
+ "AbandonedCable-Data_diff-P1009-part3",
92
+ "AbandonedCable-Data_diff-P1009-part4",
93
+ "AbandonedCable-Data_diff-P1009-part5",
94
+ "AbandonedCable-Data_diff-P1009-part6",
95
+ "AbandonedCable-Data_diff-P1009-part7",
96
+ "AbandonedCable-Data_diff-P1009-part8",
97
+ "AbandonedCable-Data_diff-P1009-part9",
98
+ "AbandonedCable-Data_diff-P1010-part1",
99
+ "AbandonedCable-Data_diff-P1010-part10",
100
+ "AbandonedCable-Data_diff-P1010-part11",
101
+ "AbandonedCable-Data_diff-P1010-part12",
102
+ "AbandonedCable-Data_diff-P1010-part2",
103
+ "AbandonedCable-Data_diff-P1010-part3",
104
+ "AbandonedCable-Data_diff-P1010-part4",
105
+ "AbandonedCable-Data_diff-P1010-part5",
106
+ "AbandonedCable-Data_diff-P1010-part6",
107
+ "AbandonedCable-Data_diff-P1010-part7",
108
+ "AbandonedCable-Data_diff-P1010-part8",
109
+ "AbandonedCable-Data_diff-P1010-part9",
110
+ "AbandonedCable-Data_omni-P0000-part1",
111
+ "AbandonedCable-Data_omni-P0000-part2",
112
+ "AbandonedCable-Data_omni-P0000-part3",
113
+ "AbandonedCable-Data_omni-P0000-part4",
114
+ "AbandonedCable-Data_omni-P0000-part5",
115
+ "AbandonedCable-Data_omni-P0000-part6",
116
+ "AbandonedCable-Data_omni-P0000-part7",
117
+ "AbandonedCable-Data_omni-P0001-part1",
118
+ "AbandonedCable-Data_omni-P0001-part2",
119
+ "AbandonedCable-Data_omni-P0001-part3",
120
+ "AbandonedCable-Data_omni-P0001-part4",
121
+ "AbandonedCable-Data_omni-P0002-part1",
122
+ "AbandonedCable-Data_omni-P0002-part10",
123
+ "AbandonedCable-Data_omni-P0002-part11",
124
+ "AbandonedCable-Data_omni-P0002-part12",
125
+ "AbandonedCable-Data_omni-P0002-part2",
126
+ "AbandonedCable-Data_omni-P0002-part3",
127
+ "AbandonedCable-Data_omni-P0002-part4",
128
+ "AbandonedCable-Data_omni-P0002-part5",
129
+ "AbandonedCable-Data_omni-P0002-part6",
130
+ "AbandonedCable-Data_omni-P0002-part7",
131
+ "AbandonedCable-Data_omni-P0002-part8",
132
+ "AbandonedCable-Data_omni-P0002-part9",
133
+ "AbandonedCable-Data_omni-P0003-part1",
134
+ "AbandonedCable-Data_omni-P0003-part10",
135
+ "AbandonedCable-Data_omni-P0003-part11",
136
+ "AbandonedCable-Data_omni-P0003-part12",
137
+ "AbandonedCable-Data_omni-P0003-part13",
138
+ "AbandonedCable-Data_omni-P0003-part14",
139
+ "AbandonedCable-Data_omni-P0003-part15",
140
+ "AbandonedCable-Data_omni-P0003-part16",
141
+ "AbandonedCable-Data_omni-P0003-part2",
142
+ "AbandonedCable-Data_omni-P0003-part3",
143
+ "AbandonedCable-Data_omni-P0003-part4",
144
+ "AbandonedCable-Data_omni-P0003-part5",
145
+ "AbandonedCable-Data_omni-P0003-part6",
146
+ "AbandonedCable-Data_omni-P0003-part7",
147
+ "AbandonedCable-Data_omni-P0003-part8",
148
+ "AbandonedCable-Data_omni-P0003-part9",
149
+ "AbandonedCable-Data_omni-P0004-part1",
150
+ "AbandonedCable-Data_omni-P0004-part10",
151
+ "AbandonedCable-Data_omni-P0004-part11",
152
+ "AbandonedCable-Data_omni-P0004-part12",
153
+ "AbandonedCable-Data_omni-P0004-part2",
154
+ "AbandonedCable-Data_omni-P0004-part3",
155
+ "AbandonedCable-Data_omni-P0004-part4",
156
+ "AbandonedCable-Data_omni-P0004-part5",
157
+ "AbandonedCable-Data_omni-P0004-part6",
158
+ "AbandonedCable-Data_omni-P0004-part7",
159
+ "AbandonedCable-Data_omni-P0004-part8",
160
+ "AbandonedCable-Data_omni-P0004-part9",
161
+ "AbandonedCable-Data_omni-P0005-part1",
162
+ "AbandonedCable-Data_omni-P0005-part2",
163
+ "AbandonedCable-Data_omni-P0005-part3",
164
+ "AbandonedCable-Data_omni-P0005-part4",
165
+ "AbandonedCable-Data_omni-P0005-part5",
166
+ "AbandonedCable-Data_omni-P0006-part1",
167
+ "AbandonedCable-Data_omni-P0006-part2",
168
+ "AbandonedCable-Data_omni-P0006-part3",
169
+ "AbandonedCable-Data_omni-P0006-part4",
170
+ "AbandonedCable-Data_omni-P0006-part5",
171
+ "AbandonedCable-Data_omni-P0006-part6",
172
+ "AbandonedCable-Data_omni-P0006-part7",
173
+ "AbandonedCable-Data_omni-P0006-part8",
174
+ "AbandonedCable-Data_omni-P0006-part9",
175
+ "AbandonedCable-Data_omni-P0007-part1",
176
+ "AbandonedCable-Data_omni-P0007-part2",
177
+ "AbandonedCable-Data_omni-P0007-part3",
178
+ "AbandonedCable-Data_omni-P0007-part4",
179
+ "AbandonedCable-Data_omni-P0007-part5",
180
+ "AbandonedCable-Data_omni-P0007-part6",
181
+ "AbandonedCable-Data_omni-P0007-part7",
182
+ "AbandonedCable-Data_omni-P0007-part8",
183
+ "AbandonedCable-Data_omni-P0008-part1",
184
+ "AbandonedCable-Data_omni-P0008-part10",
185
+ "AbandonedCable-Data_omni-P0008-part11",
186
+ "AbandonedCable-Data_omni-P0008-part12",
187
+ "AbandonedCable-Data_omni-P0008-part13",
188
+ "AbandonedCable-Data_omni-P0008-part14",
189
+ "AbandonedCable-Data_omni-P0008-part2",
190
+ "AbandonedCable-Data_omni-P0008-part3",
191
+ "AbandonedCable-Data_omni-P0008-part4",
192
+ "AbandonedCable-Data_omni-P0008-part5",
193
+ "AbandonedCable-Data_omni-P0008-part6",
194
+ "AbandonedCable-Data_omni-P0008-part7",
195
+ "AbandonedCable-Data_omni-P0008-part8",
196
+ "AbandonedCable-Data_omni-P0008-part9",
197
+ "AbandonedCable-Data_omni-P0009-part1",
198
+ "AbandonedCable-Data_omni-P0009-part2",
199
+ "AbandonedCable-Data_omni-P0009-part3",
200
+ "AbandonedCable-Data_omni-P0009-part4",
201
+ "AbandonedCable-Data_omni-P0009-part5",
202
+ "AbandonedCable-Data_omni-P0009-part6",
203
+ "AbandonedCable-Data_omni-P0009-part7",
204
+ "AbandonedCable-Data_omni-P0009-part8",
205
+ "AbandonedCable-Data_omni-P0010-part1",
206
+ "AbandonedCable-Data_omni-P0010-part2",
207
+ "AbandonedCable-Data_omni-P0010-part3",
208
+ "AbandonedCable-Data_omni-P0011-part1",
209
+ "AbandonedCable-Data_omni-P0011-part2",
210
+ "AbandonedCable-Data_omni-P0011-part3",
211
+ "AbandonedCable-Data_omni-P0011-part4",
212
+ "AbandonedCable-Data_omni-P0011-part5",
213
+ "AbandonedCable-Data_omni-P0011-part6",
214
+ "AbandonedCable-Data_omni-P0012-part1",
215
+ "AbandonedCable-Data_omni-P0012-part10",
216
+ "AbandonedCable-Data_omni-P0012-part11",
217
+ "AbandonedCable-Data_omni-P0012-part2",
218
+ "AbandonedCable-Data_omni-P0012-part3",
219
+ "AbandonedCable-Data_omni-P0012-part4",
220
+ "AbandonedCable-Data_omni-P0012-part5",
221
+ "AbandonedCable-Data_omni-P0012-part6",
222
+ "AbandonedCable-Data_omni-P0012-part7",
223
+ "AbandonedCable-Data_omni-P0012-part8",
224
+ "AbandonedCable-Data_omni-P0012-part9",
225
+ "AbandonedCable-Data_omni-P0013-part1",
226
+ "AbandonedCable-Data_omni-P0013-part10",
227
+ "AbandonedCable-Data_omni-P0013-part11",
228
+ "AbandonedCable-Data_omni-P0013-part12",
229
+ "AbandonedCable-Data_omni-P0013-part13",
230
+ "AbandonedCable-Data_omni-P0013-part14",
231
+ "AbandonedCable-Data_omni-P0013-part15",
232
+ "AbandonedCable-Data_omni-P0013-part2",
233
+ "AbandonedCable-Data_omni-P0013-part3",
234
+ "AbandonedCable-Data_omni-P0013-part4",
235
+ "AbandonedCable-Data_omni-P0013-part5",
236
+ "AbandonedCable-Data_omni-P0013-part6",
237
+ "AbandonedCable-Data_omni-P0013-part7",
238
+ "AbandonedCable-Data_omni-P0013-part8",
239
+ "AbandonedCable-Data_omni-P0013-part9",
240
+ "AbandonedFactory-Data_omni-P0000-part1",
241
+ "AbandonedFactory-Data_omni-P0000-part2",
242
+ "AbandonedFactory-Data_omni-P0000-part3",
243
+ "AbandonedFactory-Data_omni-P0000-part4",
244
+ "AbandonedFactory-Data_omni-P0000-part5",
245
+ "AbandonedFactory-Data_omni-P0001-part1",
246
+ "AbandonedFactory-Data_omni-P0001-part2",
247
+ "AbandonedFactory-Data_omni-P0001-part3",
248
+ "AbandonedFactory-Data_omni-P0001-part4",
249
+ "AbandonedFactory-Data_omni-P0001-part5",
250
+ "AbandonedFactory-Data_omni-P0001-part6",
251
+ "AbandonedFactory-Data_omni-P0002-part1",
252
+ "AbandonedFactory-Data_omni-P0002-part2",
253
+ "AbandonedFactory-Data_omni-P0002-part3",
254
+ "AbandonedFactory-Data_omni-P0002-part4",
255
+ "AbandonedFactory-Data_omni-P0002-part5",
256
+ "AbandonedFactory-Data_omni-P0004-part1",
257
+ "AbandonedFactory-Data_omni-P0004-part2",
258
+ "AbandonedFactory-Data_omni-P0004-part3",
259
+ "AbandonedFactory-Data_omni-P0004-part4",
260
+ "AbandonedFactory-Data_omni-P0005-part1",
261
+ "AbandonedFactory-Data_omni-P0005-part2",
262
+ "AbandonedFactory2-Data_diff-P1000-part1",
263
+ "AbandonedFactory2-Data_diff-P1000-part2",
264
+ "AbandonedFactory2-Data_diff-P1000-part3",
265
+ "AbandonedFactory2-Data_diff-P1000-part4",
266
+ "AbandonedFactory2-Data_diff-P1001-part1",
267
+ "AbandonedFactory2-Data_diff-P1001-part2",
268
+ "AbandonedFactory2-Data_diff-P1001-part3",
269
+ "AbandonedFactory2-Data_diff-P1001-part4",
270
+ "AbandonedFactory2-Data_diff-P1001-part5",
271
+ "AbandonedFactory2-Data_diff-P1002-part1",
272
+ "AbandonedFactory2-Data_diff-P1002-part2",
273
+ "AbandonedFactory2-Data_diff-P1002-part3",
274
+ "AbandonedFactory2-Data_diff-P1002-part4",
275
+ "AbandonedFactory2-Data_diff-P1002-part5",
276
+ "AbandonedFactory2-Data_diff-P1002-part6",
277
+ "AbandonedFactory2-Data_diff-P1002-part7",
278
+ "AbandonedFactory2-Data_omni-P0000-part1",
279
+ "AbandonedFactory2-Data_omni-P0000-part2",
280
+ "AbandonedFactory2-Data_omni-P0001-part1",
281
+ "AbandonedFactory2-Data_omni-P0001-part2",
282
+ "AbandonedFactory2-Data_omni-P0001-part3",
283
+ "AbandonedFactory2-Data_omni-P0001-part4",
284
+ "AbandonedFactory2-Data_omni-P0002-part1",
285
+ "AbandonedFactory2-Data_omni-P0002-part2",
286
+ "AbandonedFactory2-Data_omni-P0002-part3",
287
+ "AbandonedFactory2-Data_omni-P0003-part1",
288
+ "AbandonedFactory2-Data_omni-P0003-part2",
289
+ "AbandonedFactory2-Data_omni-P0003-part3",
290
+ "AbandonedFactory2-Data_omni-P0003-part4",
291
+ "AbandonedFactory2-Data_omni-P0003-part5",
292
+ "AbandonedFactory2-Data_omni-P0004-part1",
293
+ "AbandonedFactory2-Data_omni-P0004-part2",
294
+ "AbandonedFactory2-Data_omni-P0004-part3",
295
+ "AbandonedSchool-Data_omni-P0000-part1",
296
+ "AbandonedSchool-Data_omni-P0000-part2",
297
+ "AbandonedSchool-Data_omni-P0000-part3",
298
+ "AbandonedSchool-Data_omni-P0000-part4",
299
+ "AbandonedSchool-Data_omni-P0000-part5",
300
+ "AbandonedSchool-Data_omni-P0000-part6",
301
+ "AbandonedSchool-Data_omni-P0000-part7",
302
+ "AbandonedSchool-Data_omni-P0000-part8",
303
+ "AbandonedSchool-Data_omni-P0001-part1",
304
+ "AbandonedSchool-Data_omni-P0001-part2",
305
+ "AbandonedSchool-Data_omni-P0001-part3",
306
+ "AbandonedSchool-Data_omni-P0001-part4",
307
+ "AbandonedSchool-Data_omni-P0001-part5",
308
+ "AbandonedSchool-Data_omni-P0001-part6",
309
+ "AbandonedSchool-Data_omni-P0001-part7",
310
+ "AbandonedSchool-Data_omni-P0001-part8",
311
+ "AbandonedSchool-Data_omni-P0002-part1",
312
+ "AbandonedSchool-Data_omni-P0002-part2",
313
+ "AbandonedSchool-Data_omni-P0002-part3",
314
+ "AbandonedSchool-Data_omni-P0002-part4",
315
+ "AbandonedSchool-Data_omni-P0003-part1",
316
+ "AbandonedSchool-Data_omni-P0003-part10",
317
+ "AbandonedSchool-Data_omni-P0003-part11",
318
+ "AbandonedSchool-Data_omni-P0003-part12",
319
+ "AbandonedSchool-Data_omni-P0003-part13",
320
+ "AbandonedSchool-Data_omni-P0003-part2",
321
+ "AbandonedSchool-Data_omni-P0003-part3",
322
+ "AbandonedSchool-Data_omni-P0003-part4",
323
+ "AbandonedSchool-Data_omni-P0003-part5",
324
+ "AbandonedSchool-Data_omni-P0003-part6",
325
+ "AbandonedSchool-Data_omni-P0003-part7",
326
+ "AbandonedSchool-Data_omni-P0003-part8",
327
+ "AbandonedSchool-Data_omni-P0003-part9",
328
+ "AbandonedSchool-Data_omni-P0004-part1",
329
+ "AbandonedSchool-Data_omni-P0004-part10",
330
+ "AbandonedSchool-Data_omni-P0004-part11",
331
+ "AbandonedSchool-Data_omni-P0004-part12",
332
+ "AbandonedSchool-Data_omni-P0004-part2",
333
+ "AbandonedSchool-Data_omni-P0004-part3",
334
+ "AbandonedSchool-Data_omni-P0004-part4",
335
+ "AbandonedSchool-Data_omni-P0004-part5",
336
+ "AbandonedSchool-Data_omni-P0004-part6",
337
+ "AbandonedSchool-Data_omni-P0004-part7",
338
+ "AbandonedSchool-Data_omni-P0004-part8",
339
+ "AbandonedSchool-Data_omni-P0004-part9",
340
+ "AbandonedSchool-Data_omni-P0005-part1",
341
+ "AbandonedSchool-Data_omni-P0005-part10",
342
+ "AbandonedSchool-Data_omni-P0005-part11",
343
+ "AbandonedSchool-Data_omni-P0005-part12",
344
+ "AbandonedSchool-Data_omni-P0005-part13",
345
+ "AbandonedSchool-Data_omni-P0005-part2",
346
+ "AbandonedSchool-Data_omni-P0005-part3",
347
+ "AbandonedSchool-Data_omni-P0005-part4",
348
+ "AbandonedSchool-Data_omni-P0005-part5",
349
+ "AbandonedSchool-Data_omni-P0005-part6",
350
+ "AbandonedSchool-Data_omni-P0005-part7",
351
+ "AbandonedSchool-Data_omni-P0005-part8",
352
+ "AbandonedSchool-Data_omni-P0005-part9",
353
+ "AbandonedSchool-Data_omni-P0006-part1",
354
+ "AbandonedSchool-Data_omni-P0006-part2",
355
+ "AbandonedSchool-Data_omni-P0006-part3",
356
+ "AbandonedSchool-Data_omni-P0006-part4",
357
+ "AbandonedSchool-Data_omni-P0006-part5",
358
+ "AbandonedSchool-Data_omni-P0006-part6",
359
+ "AbandonedSchool-Data_omni-P0007-part1",
360
+ "AbandonedSchool-Data_omni-P0007-part2",
361
+ "AbandonedSchool-Data_omni-P0007-part3",
362
+ "AbandonedSchool-Data_omni-P0007-part4",
363
+ "AbandonedSchool-Data_omni-P0008-part1",
364
+ "AbandonedSchool-Data_omni-P0008-part2",
365
+ "AbandonedSchool-Data_omni-P0008-part3",
366
+ "AbandonedSchool-Data_omni-P0008-part4",
367
+ "AbandonedSchool-Data_omni-P0008-part5",
368
+ "AbandonedSchool-Data_omni-P0008-part6",
369
+ "AbandonedSchool-Data_omni-P0009-part1",
370
+ "AbandonedSchool-Data_omni-P0009-part2",
371
+ "AbandonedSchool-Data_omni-P0009-part3",
372
+ "AbandonedSchool-Data_omni-P0009-part4",
373
+ "HQWesternSaloon-Data_omni-P0000-part1",
374
+ "HQWesternSaloon-Data_omni-P0000-part2",
375
+ "HQWesternSaloon-Data_omni-P0001-part1",
376
+ "HQWesternSaloon-Data_omni-P0001-part2",
377
+ "HQWesternSaloon-Data_omni-P0002-part1",
378
+ "HQWesternSaloon-Data_omni-P0002-part2",
379
+ "HQWesternSaloon-Data_omni-P0002-part3",
380
+ "HQWesternSaloon-Data_omni-P0002-part4",
381
+ "Hospital-Data_diff-P1001-part1",
382
+ "Hospital-Data_diff-P1001-part10",
383
+ "Hospital-Data_diff-P1001-part11",
384
+ "Hospital-Data_diff-P1001-part12",
385
+ "Hospital-Data_diff-P1001-part13",
386
+ "Hospital-Data_diff-P1001-part14",
387
+ "Hospital-Data_diff-P1001-part15",
388
+ "Hospital-Data_diff-P1001-part16",
389
+ "Hospital-Data_diff-P1001-part2",
390
+ "Hospital-Data_diff-P1001-part3",
391
+ "Hospital-Data_diff-P1001-part4",
392
+ "Hospital-Data_diff-P1001-part5",
393
+ "Hospital-Data_diff-P1001-part6",
394
+ "Hospital-Data_diff-P1001-part7",
395
+ "Hospital-Data_diff-P1001-part8",
396
+ "Hospital-Data_diff-P1001-part9",
397
+ "Hospital-Data_diff-P1002-part1",
398
+ "Hospital-Data_diff-P1002-part10",
399
+ "Hospital-Data_diff-P1002-part11",
400
+ "Hospital-Data_diff-P1002-part12",
401
+ "Hospital-Data_diff-P1002-part13",
402
+ "Hospital-Data_diff-P1002-part14",
403
+ "Hospital-Data_diff-P1002-part2",
404
+ "Hospital-Data_diff-P1002-part3",
405
+ "Hospital-Data_diff-P1002-part4",
406
+ "Hospital-Data_diff-P1002-part5",
407
+ "Hospital-Data_diff-P1002-part6",
408
+ "Hospital-Data_diff-P1002-part7",
409
+ "Hospital-Data_diff-P1002-part8",
410
+ "Hospital-Data_diff-P1002-part9",
411
+ "Hospital-Data_diff-P1003-part1",
412
+ "Hospital-Data_diff-P1003-part10",
413
+ "Hospital-Data_diff-P1003-part11",
414
+ "Hospital-Data_diff-P1003-part2",
415
+ "Hospital-Data_diff-P1003-part3",
416
+ "Hospital-Data_diff-P1003-part4",
417
+ "Hospital-Data_diff-P1003-part5",
418
+ "Hospital-Data_diff-P1003-part6",
419
+ "Hospital-Data_diff-P1003-part7",
420
+ "Hospital-Data_diff-P1003-part8",
421
+ "Hospital-Data_diff-P1003-part9",
422
+ "Hospital-Data_diff-P1004-part1",
423
+ "Hospital-Data_diff-P1004-part10",
424
+ "Hospital-Data_diff-P1004-part11",
425
+ "Hospital-Data_diff-P1004-part12",
426
+ "Hospital-Data_diff-P1004-part13",
427
+ "Hospital-Data_diff-P1004-part14",
428
+ "Hospital-Data_diff-P1004-part15",
429
+ "Hospital-Data_diff-P1004-part16",
430
+ "Hospital-Data_diff-P1004-part17",
431
+ "Hospital-Data_diff-P1004-part18",
432
+ "Hospital-Data_diff-P1004-part2",
433
+ "Hospital-Data_diff-P1004-part3",
434
+ "Hospital-Data_diff-P1004-part4",
435
+ "Hospital-Data_diff-P1004-part5",
436
+ "Hospital-Data_diff-P1004-part6",
437
+ "Hospital-Data_diff-P1004-part7",
438
+ "Hospital-Data_diff-P1004-part8",
439
+ "Hospital-Data_diff-P1004-part9",
440
+ "Hospital-Data_diff-P1005-part1",
441
+ "Hospital-Data_diff-P1005-part10",
442
+ "Hospital-Data_diff-P1005-part11",
443
+ "Hospital-Data_diff-P1005-part2",
444
+ "Hospital-Data_diff-P1005-part3",
445
+ "Hospital-Data_diff-P1005-part4",
446
+ "Hospital-Data_diff-P1005-part5",
447
+ "Hospital-Data_diff-P1005-part6",
448
+ "Hospital-Data_diff-P1005-part7",
449
+ "Hospital-Data_diff-P1005-part8",
450
+ "Hospital-Data_diff-P1005-part9",
451
+ "Hospital-Data_omni-P0000-part1",
452
+ "Hospital-Data_omni-P0000-part10",
453
+ "Hospital-Data_omni-P0000-part2",
454
+ "Hospital-Data_omni-P0000-part3",
455
+ "Hospital-Data_omni-P0000-part4",
456
+ "Hospital-Data_omni-P0000-part5",
457
+ "Hospital-Data_omni-P0000-part6",
458
+ "Hospital-Data_omni-P0000-part7",
459
+ "Hospital-Data_omni-P0000-part8",
460
+ "Hospital-Data_omni-P0000-part9",
461
+ "Hospital-Data_omni-P0001-part1",
462
+ "Hospital-Data_omni-P0001-part2",
463
+ "Hospital-Data_omni-P0001-part3",
464
+ "Hospital-Data_omni-P0001-part4",
465
+ "Hospital-Data_omni-P0001-part5",
466
+ "Hospital-Data_omni-P0001-part6",
467
+ "Hospital-Data_omni-P0001-part7",
468
+ "Hospital-Data_omni-P0001-part8",
469
+ "Hospital-Data_omni-P0001-part9",
470
+ "Hospital-Data_omni-P0002-part1",
471
+ "Hospital-Data_omni-P0002-part10",
472
+ "Hospital-Data_omni-P0002-part11",
473
+ "Hospital-Data_omni-P0002-part12",
474
+ "Hospital-Data_omni-P0002-part13",
475
+ "Hospital-Data_omni-P0002-part2",
476
+ "Hospital-Data_omni-P0002-part3",
477
+ "Hospital-Data_omni-P0002-part4",
478
+ "Hospital-Data_omni-P0002-part5",
479
+ "Hospital-Data_omni-P0002-part6",
480
+ "Hospital-Data_omni-P0002-part7",
481
+ "Hospital-Data_omni-P0002-part8",
482
+ "Hospital-Data_omni-P0002-part9",
483
+ "Hospital-Data_omni-P0003-part1",
484
+ "Hospital-Data_omni-P0003-part10",
485
+ "Hospital-Data_omni-P0003-part11",
486
+ "Hospital-Data_omni-P0003-part12",
487
+ "Hospital-Data_omni-P0003-part2",
488
+ "Hospital-Data_omni-P0003-part3",
489
+ "Hospital-Data_omni-P0003-part4",
490
+ "Hospital-Data_omni-P0003-part5",
491
+ "Hospital-Data_omni-P0003-part6",
492
+ "Hospital-Data_omni-P0003-part7",
493
+ "Hospital-Data_omni-P0003-part8",
494
+ "Hospital-Data_omni-P0003-part9",
495
+ "Hospital-Data_omni-P0004-part1",
496
+ "Hospital-Data_omni-P0004-part2",
497
+ "Hospital-Data_omni-P0004-part3",
498
+ "Hospital-Data_omni-P0004-part4",
499
+ "Hospital-Data_omni-P0004-part5",
500
+ "Hospital-Data_omni-P0004-part6",
501
+ "Hospital-Data_omni-P0004-part7",
502
+ "Hospital-Data_omni-P0004-part8",
503
+ "Hospital-Data_omni-P0005-part1",
504
+ "Hospital-Data_omni-P0005-part10",
505
+ "Hospital-Data_omni-P0005-part11",
506
+ "Hospital-Data_omni-P0005-part12",
507
+ "Hospital-Data_omni-P0005-part13",
508
+ "Hospital-Data_omni-P0005-part14",
509
+ "Hospital-Data_omni-P0005-part15",
510
+ "Hospital-Data_omni-P0005-part16",
511
+ "Hospital-Data_omni-P0005-part17",
512
+ "Hospital-Data_omni-P0005-part2",
513
+ "Hospital-Data_omni-P0005-part3",
514
+ "Hospital-Data_omni-P0005-part4",
515
+ "Hospital-Data_omni-P0005-part5",
516
+ "Hospital-Data_omni-P0005-part6",
517
+ "Hospital-Data_omni-P0005-part7",
518
+ "Hospital-Data_omni-P0005-part8",
519
+ "Hospital-Data_omni-P0005-part9",
520
+ "House-Data_omni-P0000-part1",
521
+ "House-Data_omni-P0001-part1",
522
+ "House-Data_omni-P0001-part2",
523
+ "House-Data_omni-P0002-part1",
524
+ "House-Data_omni-P0002-part2",
525
+ "House-Data_omni-P0002-part3",
526
+ "House-Data_omni-P0002-part4",
527
+ "House-Data_omni-P0002-part5",
528
+ "House-Data_omni-P0002-part6",
529
+ "IndustrialHangar-Data_diff-P1000-part1",
530
+ "IndustrialHangar-Data_diff-P1000-part10",
531
+ "IndustrialHangar-Data_diff-P1000-part11",
532
+ "IndustrialHangar-Data_diff-P1000-part2",
533
+ "IndustrialHangar-Data_diff-P1000-part3",
534
+ "IndustrialHangar-Data_diff-P1000-part4",
535
+ "IndustrialHangar-Data_diff-P1000-part5",
536
+ "IndustrialHangar-Data_diff-P1000-part6",
537
+ "IndustrialHangar-Data_diff-P1000-part7",
538
+ "IndustrialHangar-Data_diff-P1000-part8",
539
+ "IndustrialHangar-Data_diff-P1000-part9",
540
+ "IndustrialHangar-Data_diff-P1001-part1",
541
+ "IndustrialHangar-Data_diff-P1001-part10",
542
+ "IndustrialHangar-Data_diff-P1001-part11",
543
+ "IndustrialHangar-Data_diff-P1001-part12",
544
+ "IndustrialHangar-Data_diff-P1001-part13",
545
+ "IndustrialHangar-Data_diff-P1001-part14",
546
+ "IndustrialHangar-Data_diff-P1001-part15",
547
+ "IndustrialHangar-Data_diff-P1001-part2",
548
+ "IndustrialHangar-Data_diff-P1001-part3",
549
+ "IndustrialHangar-Data_diff-P1001-part4",
550
+ "IndustrialHangar-Data_diff-P1001-part5",
551
+ "IndustrialHangar-Data_diff-P1001-part6",
552
+ "IndustrialHangar-Data_diff-P1001-part7",
553
+ "IndustrialHangar-Data_diff-P1001-part8",
554
+ "IndustrialHangar-Data_diff-P1001-part9",
555
+ "IndustrialHangar-Data_diff-P1002-part1",
556
+ "IndustrialHangar-Data_diff-P1002-part10",
557
+ "IndustrialHangar-Data_diff-P1002-part2",
558
+ "IndustrialHangar-Data_diff-P1002-part3",
559
+ "IndustrialHangar-Data_diff-P1002-part4",
560
+ "IndustrialHangar-Data_diff-P1002-part5",
561
+ "IndustrialHangar-Data_diff-P1002-part6",
562
+ "IndustrialHangar-Data_diff-P1002-part7",
563
+ "IndustrialHangar-Data_diff-P1002-part8",
564
+ "IndustrialHangar-Data_diff-P1002-part9",
565
+ "IndustrialHangar-Data_diff-P1003-part1",
566
+ "IndustrialHangar-Data_diff-P1003-part2",
567
+ "IndustrialHangar-Data_diff-P1003-part3",
568
+ "IndustrialHangar-Data_diff-P1003-part4",
569
+ "IndustrialHangar-Data_diff-P1003-part5",
570
+ "IndustrialHangar-Data_diff-P1003-part6",
571
+ "IndustrialHangar-Data_diff-P1003-part7",
572
+ "IndustrialHangar-Data_diff-P1003-part8",
573
+ "IndustrialHangar-Data_diff-P1004-part1",
574
+ "IndustrialHangar-Data_diff-P1004-part10",
575
+ "IndustrialHangar-Data_diff-P1004-part2",
576
+ "IndustrialHangar-Data_diff-P1004-part3",
577
+ "IndustrialHangar-Data_diff-P1004-part4",
578
+ "IndustrialHangar-Data_diff-P1004-part5",
579
+ "IndustrialHangar-Data_diff-P1004-part6",
580
+ "IndustrialHangar-Data_diff-P1004-part7",
581
+ "IndustrialHangar-Data_diff-P1004-part8",
582
+ "IndustrialHangar-Data_diff-P1004-part9",
583
+ "IndustrialHangar-Data_diff-P1005-part1",
584
+ "IndustrialHangar-Data_diff-P1005-part10",
585
+ "IndustrialHangar-Data_diff-P1005-part2",
586
+ "IndustrialHangar-Data_diff-P1005-part3",
587
+ "IndustrialHangar-Data_diff-P1005-part4",
588
+ "IndustrialHangar-Data_diff-P1005-part5",
589
+ "IndustrialHangar-Data_diff-P1005-part6",
590
+ "IndustrialHangar-Data_diff-P1005-part7",
591
+ "IndustrialHangar-Data_diff-P1005-part8",
592
+ "IndustrialHangar-Data_diff-P1005-part9",
593
+ "IndustrialHangar-Data_diff-P1006-part1",
594
+ "IndustrialHangar-Data_diff-P1006-part2",
595
+ "IndustrialHangar-Data_diff-P1006-part3",
596
+ "IndustrialHangar-Data_diff-P1006-part4",
597
+ "IndustrialHangar-Data_diff-P1007-part1",
598
+ "IndustrialHangar-Data_diff-P1007-part2",
599
+ "IndustrialHangar-Data_diff-P1007-part3",
600
+ "IndustrialHangar-Data_omni-P0000-part1",
601
+ "IndustrialHangar-Data_omni-P0000-part10",
602
+ "IndustrialHangar-Data_omni-P0000-part2",
603
+ "IndustrialHangar-Data_omni-P0000-part3",
604
+ "IndustrialHangar-Data_omni-P0000-part4",
605
+ "IndustrialHangar-Data_omni-P0000-part5",
606
+ "IndustrialHangar-Data_omni-P0000-part6",
607
+ "IndustrialHangar-Data_omni-P0000-part7",
608
+ "IndustrialHangar-Data_omni-P0000-part8",
609
+ "IndustrialHangar-Data_omni-P0000-part9",
610
+ "IndustrialHangar-Data_omni-P0001-part1",
611
+ "IndustrialHangar-Data_omni-P0001-part2",
612
+ "IndustrialHangar-Data_omni-P0001-part3",
613
+ "IndustrialHangar-Data_omni-P0001-part4",
614
+ "IndustrialHangar-Data_omni-P0001-part5",
615
+ "IndustrialHangar-Data_omni-P0001-part6",
616
+ "IndustrialHangar-Data_omni-P0002-part1",
617
+ "IndustrialHangar-Data_omni-P0002-part2",
618
+ "IndustrialHangar-Data_omni-P0002-part3",
619
+ "IndustrialHangar-Data_omni-P0003-part1",
620
+ "IndustrialHangar-Data_omni-P0003-part10",
621
+ "IndustrialHangar-Data_omni-P0003-part11",
622
+ "IndustrialHangar-Data_omni-P0003-part12",
623
+ "IndustrialHangar-Data_omni-P0003-part13",
624
+ "IndustrialHangar-Data_omni-P0003-part14",
625
+ "IndustrialHangar-Data_omni-P0003-part2",
626
+ "IndustrialHangar-Data_omni-P0003-part3",
627
+ "IndustrialHangar-Data_omni-P0003-part4",
628
+ "IndustrialHangar-Data_omni-P0003-part5",
629
+ "IndustrialHangar-Data_omni-P0003-part6",
630
+ "IndustrialHangar-Data_omni-P0003-part7",
631
+ "IndustrialHangar-Data_omni-P0003-part8",
632
+ "IndustrialHangar-Data_omni-P0003-part9",
633
+ "IndustrialHangar-Data_omni-P0004-part1",
634
+ "IndustrialHangar-Data_omni-P0004-part2",
635
+ "IndustrialHangar-Data_omni-P0004-part3",
636
+ "IndustrialHangar-Data_omni-P0004-part4",
637
+ "IndustrialHangar-Data_omni-P0004-part5",
638
+ "IndustrialHangar-Data_omni-P0004-part6",
639
+ "IndustrialHangar-Data_omni-P0004-part7",
640
+ "IndustrialHangar-Data_omni-P0004-part8",
641
+ "IndustrialHangar-Data_omni-P0005-part1",
642
+ "IndustrialHangar-Data_omni-P0005-part2",
643
+ "IndustrialHangar-Data_omni-P0005-part3",
644
+ "IndustrialHangar-Data_omni-P0005-part4",
645
+ "IndustrialHangar-Data_omni-P0005-part5",
646
+ "JapaneseAlley-Data_diff-P1000-part1",
647
+ "JapaneseAlley-Data_diff-P1000-part2",
648
+ "JapaneseAlley-Data_diff-P1000-part3",
649
+ "JapaneseAlley-Data_diff-P1000-part4",
650
+ "JapaneseAlley-Data_diff-P1000-part5",
651
+ "JapaneseAlley-Data_diff-P1000-part6",
652
+ "JapaneseAlley-Data_diff-P1001-part1",
653
+ "JapaneseAlley-Data_diff-P1001-part2",
654
+ "JapaneseAlley-Data_diff-P1001-part3",
655
+ "JapaneseAlley-Data_diff-P1001-part4",
656
+ "JapaneseAlley-Data_diff-P1001-part5",
657
+ "JapaneseAlley-Data_diff-P1002-part1",
658
+ "JapaneseAlley-Data_diff-P1002-part2",
659
+ "JapaneseAlley-Data_diff-P1002-part3",
660
+ "JapaneseAlley-Data_diff-P1002-part4",
661
+ "JapaneseAlley-Data_diff-P1002-part5",
662
+ "JapaneseAlley-Data_diff-P1002-part6",
663
+ "JapaneseAlley-Data_diff-P1002-part7",
664
+ "JapaneseAlley-Data_omni-P0000-part1",
665
+ "JapaneseAlley-Data_omni-P0000-part2",
666
+ "JapaneseAlley-Data_omni-P0000-part3",
667
+ "JapaneseAlley-Data_omni-P0000-part4",
668
+ "JapaneseAlley-Data_omni-P0000-part5",
669
+ "JapaneseAlley-Data_omni-P0000-part6",
670
+ "JapaneseAlley-Data_omni-P0001-part1",
671
+ "JapaneseAlley-Data_omni-P0001-part10",
672
+ "JapaneseAlley-Data_omni-P0001-part11",
673
+ "JapaneseAlley-Data_omni-P0001-part2",
674
+ "JapaneseAlley-Data_omni-P0001-part3",
675
+ "JapaneseAlley-Data_omni-P0001-part4",
676
+ "JapaneseAlley-Data_omni-P0001-part5",
677
+ "JapaneseAlley-Data_omni-P0001-part6",
678
+ "JapaneseAlley-Data_omni-P0001-part7",
679
+ "JapaneseAlley-Data_omni-P0001-part8",
680
+ "JapaneseAlley-Data_omni-P0001-part9",
681
+ "JapaneseAlley-Data_omni-P0002-part1",
682
+ "JapaneseAlley-Data_omni-P0002-part2",
683
+ "JapaneseAlley-Data_omni-P0002-part3",
684
+ "JapaneseAlley-Data_omni-P0002-part4",
685
+ "JapaneseAlley-Data_omni-P0002-part5",
686
+ "JapaneseAlley-Data_omni-P0002-part6",
687
+ "JapaneseAlley-Data_omni-P0002-part7",
688
+ "JapaneseAlley-Data_omni-P0002-part8",
689
+ "JapaneseCity-Data_omni-P0000-part1",
690
+ "JapaneseCity-Data_omni-P0000-part2",
691
+ "JapaneseCity-Data_omni-P0000-part3",
692
+ "JapaneseCity-Data_omni-P0001-part1",
693
+ "JapaneseCity-Data_omni-P0001-part2",
694
+ "JapaneseCity-Data_omni-P0001-part3",
695
+ "JapaneseCity-Data_omni-P0002-part1",
696
+ "JapaneseCity-Data_omni-P0002-part2",
697
+ "JapaneseCity-Data_omni-P0002-part3",
698
+ "JapaneseCity-Data_omni-P0002-part4",
699
+ "JapaneseCity-Data_omni-P0003-part1",
700
+ "JapaneseCity-Data_omni-P0003-part2",
701
+ "JapaneseCity-Data_omni-P0003-part3",
702
+ "JapaneseCity-Data_omni-P0003-part4",
703
+ "JapaneseCity-Data_omni-P0004-part1",
704
+ "JapaneseCity-Data_omni-P0004-part2",
705
+ "JapaneseCity-Data_omni-P0005-part1",
706
+ "JapaneseCity-Data_omni-P0005-part2",
707
+ "JapaneseCity-Data_omni-P0005-part3",
708
+ "JapaneseCity-Data_omni-P0006-part1",
709
+ "JapaneseCity-Data_omni-P0006-part2",
710
+ "JapaneseCity-Data_omni-P0006-part3",
711
+ "JapaneseCity-Data_omni-P0006-part4",
712
+ "JapaneseCity-Data_omni-P0006-part5",
713
+ "JapaneseCity-Data_omni-P0007-part1",
714
+ "JapaneseCity-Data_omni-P0007-part2",
715
+ "JapaneseCity-Data_omni-P0007-part3",
716
+ "JapaneseCity-Data_omni-P0008-part1",
717
+ "JapaneseCity-Data_omni-P0008-part2",
718
+ "JapaneseCity-Data_omni-P0008-part3",
719
+ "JapaneseCity-Data_omni-P0008-part4",
720
+ "JapaneseCity-Data_omni-P0009-part1",
721
+ "JapaneseCity-Data_omni-P0009-part2",
722
+ "JapaneseCity-Data_omni-P0009-part3",
723
+ "JapaneseCity-Data_omni-P0009-part4",
724
+ "JapaneseCity-Data_omni-P0009-part5",
725
+ "JapaneseCity-Data_omni-P0009-part6",
726
+ "JapaneseCity-Data_omni-P0009-part7",
727
+ "JapaneseCity-Data_omni-P0009-part8",
728
+ "MiddleEast-Data_diff-P1000-part1",
729
+ "MiddleEast-Data_diff-P1000-part2",
730
+ "MiddleEast-Data_diff-P1000-part3",
731
+ "MiddleEast-Data_diff-P1000-part4",
732
+ "MiddleEast-Data_diff-P1000-part5",
733
+ "MiddleEast-Data_diff-P1000-part6",
734
+ "MiddleEast-Data_diff-P1001-part1",
735
+ "MiddleEast-Data_diff-P1001-part2",
736
+ "MiddleEast-Data_diff-P1001-part3",
737
+ "MiddleEast-Data_diff-P1001-part4",
738
+ "MiddleEast-Data_diff-P1002-part1",
739
+ "MiddleEast-Data_diff-P1002-part2",
740
+ "MiddleEast-Data_diff-P1002-part3",
741
+ "MiddleEast-Data_diff-P1002-part4",
742
+ "MiddleEast-Data_diff-P1002-part5",
743
+ "MiddleEast-Data_diff-P1003-part1",
744
+ "MiddleEast-Data_diff-P1003-part2",
745
+ "MiddleEast-Data_diff-P1003-part3",
746
+ "MiddleEast-Data_diff-P1003-part4",
747
+ "MiddleEast-Data_diff-P1004-part1",
748
+ "MiddleEast-Data_diff-P1004-part2",
749
+ "MiddleEast-Data_diff-P1004-part3",
750
+ "MiddleEast-Data_diff-P1004-part4",
751
+ "MiddleEast-Data_diff-P1004-part5",
752
+ "MiddleEast-Data_diff-P1005-part1",
753
+ "MiddleEast-Data_diff-P1005-part2",
754
+ "MiddleEast-Data_diff-P1005-part3",
755
+ "MiddleEast-Data_diff-P1005-part4",
756
+ "MiddleEast-Data_diff-P1005-part5",
757
+ "MiddleEast-Data_omni-P0000-part1",
758
+ "MiddleEast-Data_omni-P0000-part2",
759
+ "MiddleEast-Data_omni-P0000-part3",
760
+ "MiddleEast-Data_omni-P0000-part4",
761
+ "MiddleEast-Data_omni-P0001-part1",
762
+ "MiddleEast-Data_omni-P0001-part2",
763
+ "MiddleEast-Data_omni-P0001-part3",
764
+ "MiddleEast-Data_omni-P0001-part4",
765
+ "MiddleEast-Data_omni-P0001-part5",
766
+ "MiddleEast-Data_omni-P0001-part6",
767
+ "MiddleEast-Data_omni-P0002-part1",
768
+ "MiddleEast-Data_omni-P0002-part2",
769
+ "MiddleEast-Data_omni-P0002-part3",
770
+ "MiddleEast-Data_omni-P0002-part4",
771
+ "MiddleEast-Data_omni-P0003-part1"
772
+ ],
773
+ "environments": [
774
+ "AbandonedCable",
775
+ "AbandonedFactory",
776
+ "AbandonedFactory2",
777
+ "AbandonedSchool",
778
+ "HQWesternSaloon",
779
+ "Hospital",
780
+ "House",
781
+ "IndustrialHangar",
782
+ "JapaneseAlley",
783
+ "JapaneseCity",
784
+ "MiddleEast"
785
+ ],
786
+ "environment_count": 11,
787
+ "parts_per_environment": {
788
+ "AbandonedCable": 230,
789
+ "AbandonedFactory": 22,
790
+ "AbandonedFactory2": 33,
791
+ "AbandonedSchool": 78,
792
+ "HQWesternSaloon": 8,
793
+ "Hospital": 139,
794
+ "House": 9,
795
+ "IndustrialHangar": 117,
796
+ "JapaneseAlley": 43,
797
+ "JapaneseCity": 39,
798
+ "MiddleEast": 44
799
+ }
800
+ }
adapters/tartanground/reencoding_script.md ADDED
@@ -0,0 +1,68 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # TartanGround Re-encoding — exact procedure
2
+
3
+ ## Upstream layout (input)
4
+
5
+ TartanGround / TartanAir ships dense cubemap trajectories with sparse depth (1-of-10 frames). Place upstream data under `data/tartanground/` matching this layout:
6
+
7
+ ```
8
+ data/tartanground/
9
+ ├── <env_name>/ # e.g. AbandonedCable, Hospital, JapaneseAlley
10
+ │ ├── Data_diff/ # diffuse pass
11
+ │ │ ├── P<XXXX>/ # per-trajectory id
12
+ │ │ │ ├── image_left/<NNNN>.png # cubemap face frames
13
+ │ │ │ ├── depth_left/<NNNN>_depth.npy # 1-of-10 frames only
14
+ │ │ │ ├── pose_left.txt # all-frames pose
15
+ │ │ │ └── …
16
+ │ ├── Data_omni/ # omnidirectional pass
17
+ │ │ └── (same structure)
18
+ │ └── …
19
+ ```
20
+
21
+ The script reads the layout from `config.yaml` so adjust `input_layout` if your TartanGround download differs.
22
+
23
+ ## Output schema (CM-EVS unified)
24
+
25
+ Each upstream trajectory of N frames is sliced into `ceil(N/200)` parts; leftover < 200 frames is folded into the previous part. Output path:
26
+
27
+ ```
28
+ outputs/tartanground/<env_name>-Data_<diff|omni>-P<XXXX>-part<N>/
29
+ ├── panorama_0000.png # ERP RGB, 2048×1024
30
+ ├── panorama_0000_depth.npy # ERP range depth (m), present only for 1-of-10 frames
31
+ ├── pose_0000.json # { qwc: [w,x,y,z], position: [x,y,z], camera_type: "cubemap_reencoded" }
32
+ ├── panorama_0001.png
33
+ └── …
34
+ ```
35
+
36
+ Within a `part<N>` directory, frame indices restart from `0000`. Use a separate `metadata/part_manifest.json` (TODO) to map back to the upstream trajectory step.
37
+
38
+ ## Run
39
+
40
+ ```bash
41
+ cd ../../code
42
+ python scripts/reencode_outdoor.py \
43
+ --source tartanground \
44
+ --config ../adapters/tartanground/config.yaml
45
+ ```
46
+
47
+ The script:
48
+
49
+ 1. Reads `config.yaml` → resolves cubemap face size, axis conversion, ERP target resolution, depth subsample stride, partition size (default 200).
50
+ 2. For each trajectory part listed in `metadata/source_manifest.json`:
51
+ - Reads cubemap faces per frame, projects to ERP at 2048×1024.
52
+ - Re-projects depth: cubemap perspective `z` → ERP **range** depth (radial). Only frames with upstream depth (1-of-10) get a `panorama_NNNN_depth.npy`.
53
+ - Reads pose, converts to CM-EVS world frame, emits `pose_NNNN.json`.
54
+ 3. Emits per-trajectory-part `meta.json` re-stating coordinate convention.
55
+
56
+ ## Verifying against paper
57
+
58
+ After running, compare with paper §4.3 Table 4:
59
+
60
+ - 63 environments / 783,944 frames is the **target**; H100-side data CM-EVS was developed against currently has 11 environments / 762 parts. Remaining environments held offline; see `../../TODO.md`.
61
+ - Resolution 2048×1024 ✓
62
+ - Median depth 3.63 m (computed on the 16,348 frames where a depth array exists per paper footnote) ✓
63
+
64
+ ## Caveats
65
+
66
+ - **No curator selection**. All v1.0 outdoor frames are full re-encoded source trajectories.
67
+ - **Sparse depth**: depth NPYs exist only on the 1-of-10 frame subsample.
68
+ - **License**: TartanGround / TartanAir typically ships under non-commercial licenses (CC-BY-NC-SA or similar). The frames you produce by running this adapter are bound by that upstream license — **not redistributable**.
blender_indoor/README.md ADDED
@@ -0,0 +1,92 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Blender indoor — CM-EVS v1.0
2
+
3
+ 374 scene instances, 13,631 ERP RGB frames, 12,634 range-depth NumPy arrays, 13,631 pose JSON files. Resolution **2048×1024**. Released under **CC-BY 4.0**.
4
+
5
+ This is the only redistributable RGB-D portion of CM-EVS. The four restricted sources (HM3D, ScanNet++, OB3D, TartanGround) ship adapter code only — see `../adapters/`.
6
+
7
+ ## Layout
8
+
9
+ ```
10
+ blender_indoor/
11
+ ├── README.md (this file)
12
+ ├── SHA256SUMS (39,896 lines covering every panorama, depth, pose)
13
+ ├── scenes/
14
+ │ ├── sence_indoor_0001/ (← from round1+2, original sence_indoor_0001)
15
+ │ │ ├── panorama_0000.png
16
+ │ │ ├── panorama_0000_depth.npy
17
+ │ │ ├── pose_0000.json
18
+ │ │ ├── panorama_0001.png
19
+ │ │ ├── panorama_0001_depth.npy
20
+ │ │ ├── pose_0001.json
21
+ │ │ └── ...
22
+ │ ├── sence_indoor_0002/
23
+ │ ├── ...
24
+ │ ├── sence_indoor_0201/ (last from round1+2)
25
+ │ ├── sence_indoor_0202/ (first from round2)
26
+ │ ├── ...
27
+ │ └── sence_indoor_0374/ (last from round2)
28
+ └── metadata/
29
+ ├── source_manifest.json aggregate stats per round
30
+ ├── splits.json scene-level 70/15/15 split
31
+ ├── frame_manifest.csv one row per frame (14 columns matching croissant.json RecordSet)
32
+ ├── scene_id_mapping.csv new_scene_id → (source_round, original_scene_id, frame_count)
33
+ └── frame_id_mapping.csv new (scene_id, frame_idx) → original H100 path
34
+ ```
35
+
36
+ ## Naming
37
+
38
+ - **Scene IDs** are renumbered consecutively `sence_indoor_0001 … sence_indoor_0374`. round1+2 (lexicographic) gets 1–201; round2 (lexicographic) gets 202–374. The 48 original `sence_indoor_XXXX` ids that appeared in **both** rounds are kept as **two separate instances** (different sampling outcomes, different SHA-256). Use `metadata/scene_id_mapping.csv` to recover the original id and source round.
39
+ - **Frame IDs** are renumbered consecutively per scene starting at `panorama_0000`. The original frame number on H100 (which may be sparse / non-consecutive) is recoverable from `metadata/frame_id_mapping.csv`.
40
+ - All three companion files for a single frame share the same numerical suffix: `panorama_NNNN.png` ↔ `panorama_NNNN_depth.npy` ↔ `pose_NNNN.json`. Some frames may lack `_depth.npy` if depth was not produced (per-frame invalid-depth ratio target ≈ 1.4% per paper §4.8).
41
+
42
+ ## Schema
43
+
44
+ Each frame is recorded under a single coordinate convention so a downstream loader does not need to branch per source:
45
+
46
+ - **World frame**: right-handed; `+X` right, `+Y` up, `+Z` forward.
47
+ - **Camera frame**: OpenCV (`+x` image right, `+y` image down, `+z` camera forward).
48
+ - **Pose**: world-to-camera quaternion `q_wc = [w, x, y, z]` (scalar-first) plus position `C_w − C_{w,0}` relative to the scene's first selected frame. Field names in JSON: `qwc`, `position`, `camera_type`.
49
+ - **ERP**: longitude `(u/W − 0.5) · 2π`, latitude `(0.5 − v/H) · π`.
50
+ - **Range depth** (not perspective `z`-depth): each pixel stores the radial distance from camera center to surface, in metres. Invalid pixels are NaN or 0.
51
+
52
+ ```python
53
+ import json, numpy as np
54
+ from PIL import Image
55
+ sid, fid = "sence_indoor_0042", "0007"
56
+ rgb = np.asarray(Image.open(f"scenes/{sid}/panorama_{fid}.png")) # (1024, 2048, 3) uint8
57
+ depth = np.load(f"scenes/{sid}/panorama_{fid}_depth.npy") # (1024, 2048) float32; NaN/0 = invalid
58
+ pose = json.load(open(f"scenes/{sid}/pose_{fid}.json")) # {qwc: [w,x,y,z], position: [x,y,z], ...}
59
+ ```
60
+
61
+ ## Splits
62
+
63
+ Default scene-level **70 / 15 / 15** via `sha256(new_scene_id) % 100`:
64
+
65
+ - `train` if hash mod 100 < 70
66
+ - `val` if 70 ≤ hash mod 100 < 85
67
+ - `test` otherwise
68
+
69
+ Concrete counts and lists are in `metadata/splits.json`. Use this as the canonical split for any reported number against this dataset.
70
+
71
+ ## Per-scene curator metadata (coming in v1.1)
72
+
73
+ Once the curator runs on the merged 374-scene set, each scene will additionally contain:
74
+
75
+ - `meta.json` — re-states coordinate convention + records absolute first-frame center
76
+ - `metadata/selected_viewpoints.json` — chosen ids + scores + gains + conflicts
77
+ - `metadata/candidates.jsonl` — feasible candidates with 26-direction validity flags
78
+ - `metadata/per_step_log.jsonl` — per-step `G_t`, `L_t`, `s_t`, runtime
79
+
80
+ These are documented in paper §4.1 Table; tracked under `TODO.md`.
81
+
82
+ ## Verifying integrity
83
+
84
+ ```bash
85
+ cd blender_indoor
86
+ shasum -a 256 -c SHA256SUMS
87
+ # 39,896 / 39,896 should pass
88
+ ```
89
+
90
+ ## License
91
+
92
+ Frames here are derived from CC0 / CC-BY-4.0 Blender scene assets. The CM-EVS release license for these frames is **CC-BY 4.0**. Attribution required for redistribution; cite the dataset paper. See top-level `LICENSE.md` for the full matrix.
blender_indoor/SHA256SUMS ADDED
The diff for this file is too large to render. See raw diff
 
blender_indoor/metadata/frame_id_mapping.csv ADDED
The diff for this file is too large to render. See raw diff
 
blender_indoor/metadata/frame_manifest.csv ADDED
The diff for this file is too large to render. See raw diff
 
blender_indoor/metadata/scene_id_mapping.csv ADDED
@@ -0,0 +1,375 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ new_scene_id,source_round,original_scene_id,frame_count
2
+ sence_indoor_0001,round1+2,sence_indoor_0001,33
3
+ sence_indoor_0002,round1+2,sence_indoor_0002,33
4
+ sence_indoor_0003,round1+2,sence_indoor_0003,29
5
+ sence_indoor_0004,round1+2,sence_indoor_0004,29
6
+ sence_indoor_0005,round1+2,sence_indoor_0005,33
7
+ sence_indoor_0006,round1+2,sence_indoor_0005-第二轮,47
8
+ sence_indoor_0007,round1+2,sence_indoor_0007,12
9
+ sence_indoor_0008,round1+2,sence_indoor_0008,53
10
+ sence_indoor_0009,round1+2,sence_indoor_0009,23
11
+ sence_indoor_0010,round1+2,sence_indoor_0012,53
12
+ sence_indoor_0011,round1+2,sence_indoor_0013,53
13
+ sence_indoor_0012,round1+2,sence_indoor_0014,33
14
+ sence_indoor_0013,round1+2,sence_indoor_0015,33
15
+ sence_indoor_0014,round1+2,sence_indoor_0016,35
16
+ sence_indoor_0015,round1+2,sence_indoor_0018,33
17
+ sence_indoor_0016,round1+2,sence_indoor_0018-第二轮,15
18
+ sence_indoor_0017,round1+2,sence_indoor_0019,33
19
+ sence_indoor_0018,round1+2,sence_indoor_0020,33
20
+ sence_indoor_0019,round1+2,sence_indoor_0021,21
21
+ sence_indoor_0020,round1+2,sence_indoor_0021-第二轮,31
22
+ sence_indoor_0021,round1+2,sence_indoor_0023,16
23
+ sence_indoor_0022,round1+2,sence_indoor_0024,53
24
+ sence_indoor_0023,round1+2,sence_indoor_0027,29
25
+ sence_indoor_0024,round1+2,sence_indoor_0028,21
26
+ sence_indoor_0025,round1+2,sence_indoor_0030,22
27
+ sence_indoor_0026,round1+2,sence_indoor_0031,7
28
+ sence_indoor_0027,round1+2,sence_indoor_0036,23
29
+ sence_indoor_0028,round1+2,sence_indoor_0036-第二轮,53
30
+ sence_indoor_0029,round1+2,sence_indoor_0037,53
31
+ sence_indoor_0030,round1+2,sence_indoor_0038,29
32
+ sence_indoor_0031,round1+2,sence_indoor_0040,48
33
+ sence_indoor_0032,round1+2,sence_indoor_0041,29
34
+ sence_indoor_0033,round1+2,sence_indoor_0041-第二轮,12
35
+ sence_indoor_0034,round1+2,sence_indoor_0043,53
36
+ sence_indoor_0035,round1+2,sence_indoor_0044,33
37
+ sence_indoor_0036,round1+2,sence_indoor_0045-第二轮,31
38
+ sence_indoor_0037,round1+2,sence_indoor_0048-第二轮,53
39
+ sence_indoor_0038,round1+2,sence_indoor_0050,53
40
+ sence_indoor_0039,round1+2,sence_indoor_0051,21
41
+ sence_indoor_0040,round1+2,sence_indoor_0054,15
42
+ sence_indoor_0041,round1+2,sence_indoor_0057,25
43
+ sence_indoor_0042,round1+2,sence_indoor_0058,23
44
+ sence_indoor_0043,round1+2,sence_indoor_0060,29
45
+ sence_indoor_0044,round1+2,sence_indoor_0067,9
46
+ sence_indoor_0045,round1+2,sence_indoor_0069,15
47
+ sence_indoor_0046,round1+2,sence_indoor_0070,53
48
+ sence_indoor_0047,round1+2,sence_indoor_0071,33
49
+ sence_indoor_0048,round1+2,sence_indoor_0072,52
50
+ sence_indoor_0049,round1+2,sence_indoor_0074,25
51
+ sence_indoor_0050,round1+2,sence_indoor_0074-第二轮,26
52
+ sence_indoor_0051,round1+2,sence_indoor_0075,17
53
+ sence_indoor_0052,round1+2,sence_indoor_0076,33
54
+ sence_indoor_0053,round1+2,sence_indoor_0076-第二轮,17
55
+ sence_indoor_0054,round1+2,sence_indoor_0077,21
56
+ sence_indoor_0055,round1+2,sence_indoor_0083,33
57
+ sence_indoor_0056,round1+2,sence_indoor_0084,53
58
+ sence_indoor_0057,round1+2,sence_indoor_0085,53
59
+ sence_indoor_0058,round1+2,sence_indoor_0086,53
60
+ sence_indoor_0059,round1+2,sence_indoor_0088,33
61
+ sence_indoor_0060,round1+2,sence_indoor_0089,23
62
+ sence_indoor_0061,round1+2,sence_indoor_0091,17
63
+ sence_indoor_0062,round1+2,sence_indoor_0092,33
64
+ sence_indoor_0063,round1+2,sence_indoor_0092-第二轮,53
65
+ sence_indoor_0064,round1+2,sence_indoor_0094,9
66
+ sence_indoor_0065,round1+2,sence_indoor_0094-第二轮,46
67
+ sence_indoor_0066,round1+2,sence_indoor_0095,33
68
+ sence_indoor_0067,round1+2,sence_indoor_0096,30
69
+ sence_indoor_0068,round1+2,sence_indoor_0098,52
70
+ sence_indoor_0069,round1+2,sence_indoor_0100,33
71
+ sence_indoor_0070,round1+2,sence_indoor_0100-第二轮,53
72
+ sence_indoor_0071,round1+2,sence_indoor_0102,22
73
+ sence_indoor_0072,round1+2,sence_indoor_0104,33
74
+ sence_indoor_0073,round1+2,sence_indoor_0105,33
75
+ sence_indoor_0074,round1+2,sence_indoor_0106,33
76
+ sence_indoor_0075,round1+2,sence_indoor_0108,53
77
+ sence_indoor_0076,round1+2,sence_indoor_0111,33
78
+ sence_indoor_0077,round1+2,sence_indoor_0111-第二轮,12
79
+ sence_indoor_0078,round1+2,sence_indoor_0112,33
80
+ sence_indoor_0079,round1+2,sence_indoor_0113,29
81
+ sence_indoor_0080,round1+2,sence_indoor_0113-第二轮,50
82
+ sence_indoor_0081,round1+2,sence_indoor_0114,33
83
+ sence_indoor_0082,round1+2,sence_indoor_0116,53
84
+ sence_indoor_0083,round1+2,sence_indoor_0122,33
85
+ sence_indoor_0084,round1+2,sence_indoor_0123,52
86
+ sence_indoor_0085,round1+2,sence_indoor_0124,33
87
+ sence_indoor_0086,round1+2,sence_indoor_0124-第二轮,49
88
+ sence_indoor_0087,round1+2,sence_indoor_0125,53
89
+ sence_indoor_0088,round1+2,sence_indoor_0127,29
90
+ sence_indoor_0089,round1+2,sence_indoor_0128,33
91
+ sence_indoor_0090,round1+2,sence_indoor_0128-第二轮,16
92
+ sence_indoor_0091,round1+2,sence_indoor_0129,53
93
+ sence_indoor_0092,round1+2,sence_indoor_0131,33
94
+ sence_indoor_0093,round1+2,sence_indoor_0132,33
95
+ sence_indoor_0094,round1+2,sence_indoor_0132-第二轮,7
96
+ sence_indoor_0095,round1+2,sence_indoor_0134,33
97
+ sence_indoor_0096,round1+2,sence_indoor_0135,13
98
+ sence_indoor_0097,round1+2,sence_indoor_0135-第二轮,53
99
+ sence_indoor_0098,round1+2,sence_indoor_0137,53
100
+ sence_indoor_0099,round1+2,sence_indoor_0138,29
101
+ sence_indoor_0100,round1+2,sence_indoor_0139,33
102
+ sence_indoor_0101,round1+2,sence_indoor_0139-第二轮,15
103
+ sence_indoor_0102,round1+2,sence_indoor_0140,29
104
+ sence_indoor_0103,round1+2,sence_indoor_0141,33
105
+ sence_indoor_0104,round1+2,sence_indoor_0142,33
106
+ sence_indoor_0105,round1+2,sence_indoor_0144,25
107
+ sence_indoor_0106,round1+2,sence_indoor_0145,13
108
+ sence_indoor_0107,round1+2,sence_indoor_0146,33
109
+ sence_indoor_0108,round1+2,sence_indoor_0150,29
110
+ sence_indoor_0109,round1+2,sence_indoor_0153-第二轮,30
111
+ sence_indoor_0110,round1+2,sence_indoor_0155,30
112
+ sence_indoor_0111,round1+2,sence_indoor_0156,53
113
+ sence_indoor_0112,round1+2,sence_indoor_0165-第二轮,53
114
+ sence_indoor_0113,round1+2,sence_indoor_0169,9
115
+ sence_indoor_0114,round1+2,sence_indoor_0169-第二轮,53
116
+ sence_indoor_0115,round1+2,sence_indoor_0170,21
117
+ sence_indoor_0116,round1+2,sence_indoor_0170-第二轮,51
118
+ sence_indoor_0117,round1+2,sence_indoor_0172,36
119
+ sence_indoor_0118,round1+2,sence_indoor_0173,33
120
+ sence_indoor_0119,round1+2,sence_indoor_0174,29
121
+ sence_indoor_0120,round1+2,sence_indoor_0175,29
122
+ sence_indoor_0121,round1+2,sence_indoor_0177,13
123
+ sence_indoor_0122,round1+2,sence_indoor_0177-第二轮,53
124
+ sence_indoor_0123,round1+2,sence_indoor_0180,27
125
+ sence_indoor_0124,round1+2,sence_indoor_0181,47
126
+ sence_indoor_0125,round1+2,sence_indoor_0182,25
127
+ sence_indoor_0126,round1+2,sence_indoor_0184,53
128
+ sence_indoor_0127,round1+2,sence_indoor_0192,48
129
+ sence_indoor_0128,round1+2,sence_indoor_0193,33
130
+ sence_indoor_0129,round1+2,sence_indoor_0194,24
131
+ sence_indoor_0130,round1+2,sence_indoor_0216,33
132
+ sence_indoor_0131,round1+2,sence_indoor_0230,14
133
+ sence_indoor_0132,round1+2,sence_indoor_0234,30
134
+ sence_indoor_0133,round1+2,sence_indoor_0238,33
135
+ sence_indoor_0134,round1+2,sence_indoor_0239,33
136
+ sence_indoor_0135,round1+2,sence_indoor_0245,29
137
+ sence_indoor_0136,round1+2,sence_indoor_0248,33
138
+ sence_indoor_0137,round1+2,sence_indoor_0252,33
139
+ sence_indoor_0138,round1+2,sence_indoor_0255,33
140
+ sence_indoor_0139,round1+2,sence_indoor_0260,29
141
+ sence_indoor_0140,round1+2,sence_indoor_0264,26
142
+ sence_indoor_0141,round1+2,sence_indoor_0266,29
143
+ sence_indoor_0142,round1+2,sence_indoor_0267,33
144
+ sence_indoor_0143,round1+2,sence_indoor_0268,32
145
+ sence_indoor_0144,round1+2,sence_indoor_0269,29
146
+ sence_indoor_0145,round1+2,sence_indoor_0270,29
147
+ sence_indoor_0146,round1+2,sence_indoor_0271,28
148
+ sence_indoor_0147,round1+2,sence_indoor_0276,33
149
+ sence_indoor_0148,round1+2,sence_indoor_0277,25
150
+ sence_indoor_0149,round1+2,sence_indoor_0284,33
151
+ sence_indoor_0150,round1+2,sence_indoor_0285,31
152
+ sence_indoor_0151,round1+2,sence_indoor_0290,33
153
+ sence_indoor_0152,round1+2,sence_indoor_0294,33
154
+ sence_indoor_0153,round1+2,sence_indoor_0295,33
155
+ sence_indoor_0154,round1+2,sence_indoor_0295-第二轮,53
156
+ sence_indoor_0155,round1+2,sence_indoor_0296,33
157
+ sence_indoor_0156,round1+2,sence_indoor_0296-第二轮,53
158
+ sence_indoor_0157,round1+2,sence_indoor_0297,7
159
+ sence_indoor_0158,round1+2,sence_indoor_0298,50
160
+ sence_indoor_0159,round1+2,sence_indoor_0301,31
161
+ sence_indoor_0160,round1+2,sence_indoor_0302,53
162
+ sence_indoor_0161,round1+2,sence_indoor_0305,53
163
+ sence_indoor_0162,round1+2,sence_indoor_0306,28
164
+ sence_indoor_0163,round1+2,sence_indoor_0308,24
165
+ sence_indoor_0164,round1+2,sence_indoor_0309,53
166
+ sence_indoor_0165,round1+2,sence_indoor_0315,33
167
+ sence_indoor_0166,round1+2,sence_indoor_0317,25
168
+ sence_indoor_0167,round1+2,sence_indoor_0317-第二轮,16
169
+ sence_indoor_0168,round1+2,sence_indoor_0319,22
170
+ sence_indoor_0169,round1+2,sence_indoor_0320,23
171
+ sence_indoor_0170,round1+2,sence_indoor_0320-第二轮,53
172
+ sence_indoor_0171,round1+2,sence_indoor_0325,27
173
+ sence_indoor_0172,round1+2,sence_indoor_0325-第二轮,53
174
+ sence_indoor_0173,round1+2,sence_indoor_0326,33
175
+ sence_indoor_0174,round1+2,sence_indoor_0327,53
176
+ sence_indoor_0175,round1+2,sence_indoor_0328,19
177
+ sence_indoor_0176,round1+2,sence_indoor_0329,31
178
+ sence_indoor_0177,round1+2,sence_indoor_0330,53
179
+ sence_indoor_0178,round1+2,sence_indoor_0331,47
180
+ sence_indoor_0179,round1+2,sence_indoor_0334,53
181
+ sence_indoor_0180,round1+2,sence_indoor_0335,33
182
+ sence_indoor_0181,round1+2,sence_indoor_0339,40
183
+ sence_indoor_0182,round1+2,sence_indoor_0341,26
184
+ sence_indoor_0183,round1+2,sence_indoor_0343,51
185
+ sence_indoor_0184,round1+2,sence_indoor_0347,53
186
+ sence_indoor_0185,round1+2,sence_indoor_0349,34
187
+ sence_indoor_0186,round1+2,sence_indoor_0350,53
188
+ sence_indoor_0187,round1+2,sence_indoor_0355,33
189
+ sence_indoor_0188,round1+2,sence_indoor_0358,33
190
+ sence_indoor_0189,round1+2,sence_indoor_0360,3
191
+ sence_indoor_0190,round1+2,sence_indoor_0362,29
192
+ sence_indoor_0191,round1+2,sence_indoor_0364,19
193
+ sence_indoor_0192,round1+2,sence_indoor_0365,33
194
+ sence_indoor_0193,round1+2,sence_indoor_0372,33
195
+ sence_indoor_0194,round1+2,sence_indoor_0377,31
196
+ sence_indoor_0195,round1+2,sence_indoor_0379,33
197
+ sence_indoor_0196,round1+2,sence_indoor_0381,33
198
+ sence_indoor_0197,round1+2,sence_indoor_0382,33
199
+ sence_indoor_0198,round1+2,sence_indoor_0385,33
200
+ sence_indoor_0199,round1+2,sence_indoor_0389,33
201
+ sence_indoor_0200,round1+2,sence_indoor_0393,26
202
+ sence_indoor_0201,round1+2,sence_indoor_0394,20
203
+ sence_indoor_0202,round2,sence_indoor_0002,53
204
+ sence_indoor_0203,round2,sence_indoor_0009,53
205
+ sence_indoor_0204,round2,sence_indoor_0019,38
206
+ sence_indoor_0205,round2,sence_indoor_0020,47
207
+ sence_indoor_0206,round2,sence_indoor_0022,19
208
+ sence_indoor_0207,round2,sence_indoor_0030,53
209
+ sence_indoor_0208,round2,sence_indoor_0032,52
210
+ sence_indoor_0209,round2,sence_indoor_0033,48
211
+ sence_indoor_0210,round2,sence_indoor_0034,41
212
+ sence_indoor_0211,round2,sence_indoor_0035,48
213
+ sence_indoor_0212,round2,sence_indoor_0038,37
214
+ sence_indoor_0213,round2,sence_indoor_0039,18
215
+ sence_indoor_0214,round2,sence_indoor_0047,44
216
+ sence_indoor_0215,round2,sence_indoor_0051,53
217
+ sence_indoor_0216,round2,sence_indoor_0062,21
218
+ sence_indoor_0217,round2,sence_indoor_0064,28
219
+ sence_indoor_0218,round2,sence_indoor_0065,51
220
+ sence_indoor_0219,round2,sence_indoor_0073,20
221
+ sence_indoor_0220,round2,sence_indoor_0081,53
222
+ sence_indoor_0221,round2,sence_indoor_0087,53
223
+ sence_indoor_0222,round2,sence_indoor_0089,53
224
+ sence_indoor_0223,round2,sence_indoor_0090,14
225
+ sence_indoor_0224,round2,sence_indoor_0091,30
226
+ sence_indoor_0225,round2,sence_indoor_0095,42
227
+ sence_indoor_0226,round2,sence_indoor_0096,37
228
+ sence_indoor_0227,round2,sence_indoor_0101,34
229
+ sence_indoor_0228,round2,sence_indoor_0102,53
230
+ sence_indoor_0229,round2,sence_indoor_0103,39
231
+ sence_indoor_0230,round2,sence_indoor_0104,29
232
+ sence_indoor_0231,round2,sence_indoor_0114,38
233
+ sence_indoor_0232,round2,sence_indoor_0115,52
234
+ sence_indoor_0233,round2,sence_indoor_0117,17
235
+ sence_indoor_0234,round2,sence_indoor_0118,29
236
+ sence_indoor_0235,round2,sence_indoor_0119,50
237
+ sence_indoor_0236,round2,sence_indoor_0120,43
238
+ sence_indoor_0237,round2,sence_indoor_0126,51
239
+ sence_indoor_0238,round2,sence_indoor_0131,49
240
+ sence_indoor_0239,round2,sence_indoor_0133,53
241
+ sence_indoor_0240,round2,sence_indoor_0134,35
242
+ sence_indoor_0241,round2,sence_indoor_0136,53
243
+ sence_indoor_0242,round2,sence_indoor_0138,45
244
+ sence_indoor_0243,round2,sence_indoor_0140,31
245
+ sence_indoor_0244,round2,sence_indoor_0147,29
246
+ sence_indoor_0245,round2,sence_indoor_0148,53
247
+ sence_indoor_0246,round2,sence_indoor_0161,50
248
+ sence_indoor_0247,round2,sence_indoor_0164,53
249
+ sence_indoor_0248,round2,sence_indoor_0166,53
250
+ sence_indoor_0249,round2,sence_indoor_0167,53
251
+ sence_indoor_0250,round2,sence_indoor_0171,53
252
+ sence_indoor_0251,round2,sence_indoor_0182,33
253
+ sence_indoor_0252,round2,sence_indoor_0187,50
254
+ sence_indoor_0253,round2,sence_indoor_0191,35
255
+ sence_indoor_0254,round2,sence_indoor_0193,46
256
+ sence_indoor_0255,round2,sence_indoor_0195,53
257
+ sence_indoor_0256,round2,sence_indoor_0196,14
258
+ sence_indoor_0257,round2,sence_indoor_0197,53
259
+ sence_indoor_0258,round2,sence_indoor_0198,29
260
+ sence_indoor_0259,round2,sence_indoor_0199,53
261
+ sence_indoor_0260,round2,sence_indoor_0200,53
262
+ sence_indoor_0261,round2,sence_indoor_0201,6
263
+ sence_indoor_0262,round2,sence_indoor_0202,2
264
+ sence_indoor_0263,round2,sence_indoor_0203,4
265
+ sence_indoor_0264,round2,sence_indoor_0204,53
266
+ sence_indoor_0265,round2,sence_indoor_0205,53
267
+ sence_indoor_0266,round2,sence_indoor_0206,54
268
+ sence_indoor_0267,round2,sence_indoor_0207,1
269
+ sence_indoor_0268,round2,sence_indoor_0208,53
270
+ sence_indoor_0269,round2,sence_indoor_0209,3
271
+ sence_indoor_0270,round2,sence_indoor_0210,53
272
+ sence_indoor_0271,round2,sence_indoor_0211,9
273
+ sence_indoor_0272,round2,sence_indoor_0212,53
274
+ sence_indoor_0273,round2,sence_indoor_0213,53
275
+ sence_indoor_0274,round2,sence_indoor_0215,53
276
+ sence_indoor_0275,round2,sence_indoor_0216,12
277
+ sence_indoor_0276,round2,sence_indoor_0217,16
278
+ sence_indoor_0277,round2,sence_indoor_0218,53
279
+ sence_indoor_0278,round2,sence_indoor_0219,53
280
+ sence_indoor_0279,round2,sence_indoor_0220,53
281
+ sence_indoor_0280,round2,sence_indoor_0221,53
282
+ sence_indoor_0281,round2,sence_indoor_0222,39
283
+ sence_indoor_0282,round2,sence_indoor_0224,49
284
+ sence_indoor_0283,round2,sence_indoor_0225,21
285
+ sence_indoor_0284,round2,sence_indoor_0226,53
286
+ sence_indoor_0285,round2,sence_indoor_0227,53
287
+ sence_indoor_0286,round2,sence_indoor_0228,22
288
+ sence_indoor_0287,round2,sence_indoor_0229,53
289
+ sence_indoor_0288,round2,sence_indoor_0230,53
290
+ sence_indoor_0289,round2,sence_indoor_0231,53
291
+ sence_indoor_0290,round2,sence_indoor_0232,53
292
+ sence_indoor_0291,round2,sence_indoor_0233,21
293
+ sence_indoor_0292,round2,sence_indoor_0234,53
294
+ sence_indoor_0293,round2,sence_indoor_0235,53
295
+ sence_indoor_0294,round2,sence_indoor_0236,53
296
+ sence_indoor_0295,round2,sence_indoor_0237,37
297
+ sence_indoor_0296,round2,sence_indoor_0238,53
298
+ sence_indoor_0297,round2,sence_indoor_0239,53
299
+ sence_indoor_0298,round2,sence_indoor_0242,9
300
+ sence_indoor_0299,round2,sence_indoor_0243,6
301
+ sence_indoor_0300,round2,sence_indoor_0244,2
302
+ sence_indoor_0301,round2,sence_indoor_0247,53
303
+ sence_indoor_0302,round2,sence_indoor_0248,53
304
+ sence_indoor_0303,round2,sence_indoor_0249,25
305
+ sence_indoor_0304,round2,sence_indoor_0250,48
306
+ sence_indoor_0305,round2,sence_indoor_0252,2
307
+ sence_indoor_0306,round2,sence_indoor_0253,53
308
+ sence_indoor_0307,round2,sence_indoor_0254,3
309
+ sence_indoor_0308,round2,sence_indoor_0255,53
310
+ sence_indoor_0309,round2,sence_indoor_0256,53
311
+ sence_indoor_0310,round2,sence_indoor_0257,2
312
+ sence_indoor_0311,round2,sence_indoor_0258,53
313
+ sence_indoor_0312,round2,sence_indoor_0260,45
314
+ sence_indoor_0313,round2,sence_indoor_0261,3
315
+ sence_indoor_0314,round2,sence_indoor_0262,37
316
+ sence_indoor_0315,round2,sence_indoor_0263,53
317
+ sence_indoor_0316,round2,sence_indoor_0264,53
318
+ sence_indoor_0317,round2,sence_indoor_0265,48
319
+ sence_indoor_0318,round2,sence_indoor_0266,53
320
+ sence_indoor_0319,round2,sence_indoor_0268,49
321
+ sence_indoor_0320,round2,sence_indoor_0269,1
322
+ sence_indoor_0321,round2,sence_indoor_0270,53
323
+ sence_indoor_0322,round2,sence_indoor_0271,16
324
+ sence_indoor_0323,round2,sence_indoor_0272,29
325
+ sence_indoor_0324,round2,sence_indoor_0273,4
326
+ sence_indoor_0325,round2,sence_indoor_0274,14
327
+ sence_indoor_0326,round2,sence_indoor_0275,53
328
+ sence_indoor_0327,round2,sence_indoor_0276,53
329
+ sence_indoor_0328,round2,sence_indoor_0277,53
330
+ sence_indoor_0329,round2,sence_indoor_0278,53
331
+ sence_indoor_0330,round2,sence_indoor_0279,53
332
+ sence_indoor_0331,round2,sence_indoor_0280,15
333
+ sence_indoor_0332,round2,sence_indoor_0281,53
334
+ sence_indoor_0333,round2,sence_indoor_0282,53
335
+ sence_indoor_0334,round2,sence_indoor_0283,53
336
+ sence_indoor_0335,round2,sence_indoor_0284,53
337
+ sence_indoor_0336,round2,sence_indoor_0286,53
338
+ sence_indoor_0337,round2,sence_indoor_0287,53
339
+ sence_indoor_0338,round2,sence_indoor_0288,53
340
+ sence_indoor_0339,round2,sence_indoor_0289,14
341
+ sence_indoor_0340,round2,sence_indoor_0290,2
342
+ sence_indoor_0341,round2,sence_indoor_0291,5
343
+ sence_indoor_0342,round2,sence_indoor_0292,53
344
+ sence_indoor_0343,round2,sence_indoor_0293,37
345
+ sence_indoor_0344,round2,sence_indoor_0294,53
346
+ sence_indoor_0345,round2,sence_indoor_0297,53
347
+ sence_indoor_0346,round2,sence_indoor_0299,53
348
+ sence_indoor_0347,round2,sence_indoor_0300,1
349
+ sence_indoor_0348,round2,sence_indoor_0301,53
350
+ sence_indoor_0349,round2,sence_indoor_0303,53
351
+ sence_indoor_0350,round2,sence_indoor_0304,53
352
+ sence_indoor_0351,round2,sence_indoor_0306,53
353
+ sence_indoor_0352,round2,sence_indoor_0307,53
354
+ sence_indoor_0353,round2,sence_indoor_0308,53
355
+ sence_indoor_0354,round2,sence_indoor_0310,53
356
+ sence_indoor_0355,round2,sence_indoor_0311,53
357
+ sence_indoor_0356,round2,sence_indoor_0312,53
358
+ sence_indoor_0357,round2,sence_indoor_0313,2
359
+ sence_indoor_0358,round2,sence_indoor_0314,53
360
+ sence_indoor_0359,round2,sence_indoor_0315,6
361
+ sence_indoor_0360,round2,sence_indoor_0316,53
362
+ sence_indoor_0361,round2,sence_indoor_0318,53
363
+ sence_indoor_0362,round2,sence_indoor_0319,53
364
+ sence_indoor_0363,round2,sence_indoor_0321,53
365
+ sence_indoor_0364,round2,sence_indoor_0323,53
366
+ sence_indoor_0365,round2,sence_indoor_0324,20
367
+ sence_indoor_0366,round2,sence_indoor_0326,53
368
+ sence_indoor_0367,round2,sence_indoor_0328,53
369
+ sence_indoor_0368,round2,sence_indoor_0332,28
370
+ sence_indoor_0369,round2,sence_indoor_0333,26
371
+ sence_indoor_0370,round2,sence_indoor_0338,13
372
+ sence_indoor_0371,round2,sence_indoor_0340,51
373
+ sence_indoor_0372,round2,sence_indoor_0342,31
374
+ sence_indoor_0373,round2,sence_indoor_0344,45
375
+ sence_indoor_0374,round2,sence_indoor_0346,41
blender_indoor/metadata/source_manifest.json ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "source": "blender_indoor",
3
+ "license": "CC-BY-4.0",
4
+ "scene_count": 374,
5
+ "frame_count": 13631,
6
+ "rounds": {
7
+ "round1+2": {
8
+ "scene_count": 201,
9
+ "frame_count": 6740
10
+ },
11
+ "round2": {
12
+ "scene_count": 173,
13
+ "frame_count": 6891
14
+ }
15
+ },
16
+ "scene_id_range": [
17
+ "sence_indoor_0001",
18
+ "sence_indoor_0374"
19
+ ],
20
+ "naming": {
21
+ "scene_id_format": "sence_indoor_{0001..NNNN}",
22
+ "frame_files": [
23
+ "panorama_{idx:04d}.png",
24
+ "panorama_{idx:04d}_depth.npy",
25
+ "pose_{idx:04d}.json"
26
+ ],
27
+ "id_origin_traceability": "see scene_id_mapping.csv and frame_id_mapping.csv"
28
+ }
29
+ }
blender_indoor/metadata/splits.json ADDED
@@ -0,0 +1,388 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "strategy": "scene-level 70/15/15 via sha256(new_scene_id) % 100",
3
+ "counts": {
4
+ "train": 254,
5
+ "val": 73,
6
+ "test": 47
7
+ },
8
+ "train": [
9
+ "sence_indoor_0002",
10
+ "sence_indoor_0003",
11
+ "sence_indoor_0004",
12
+ "sence_indoor_0005",
13
+ "sence_indoor_0008",
14
+ "sence_indoor_0009",
15
+ "sence_indoor_0012",
16
+ "sence_indoor_0013",
17
+ "sence_indoor_0014",
18
+ "sence_indoor_0015",
19
+ "sence_indoor_0018",
20
+ "sence_indoor_0019",
21
+ "sence_indoor_0020",
22
+ "sence_indoor_0021",
23
+ "sence_indoor_0022",
24
+ "sence_indoor_0023",
25
+ "sence_indoor_0025",
26
+ "sence_indoor_0026",
27
+ "sence_indoor_0027",
28
+ "sence_indoor_0028",
29
+ "sence_indoor_0030",
30
+ "sence_indoor_0031",
31
+ "sence_indoor_0033",
32
+ "sence_indoor_0034",
33
+ "sence_indoor_0036",
34
+ "sence_indoor_0038",
35
+ "sence_indoor_0040",
36
+ "sence_indoor_0041",
37
+ "sence_indoor_0042",
38
+ "sence_indoor_0043",
39
+ "sence_indoor_0046",
40
+ "sence_indoor_0047",
41
+ "sence_indoor_0048",
42
+ "sence_indoor_0049",
43
+ "sence_indoor_0050",
44
+ "sence_indoor_0051",
45
+ "sence_indoor_0052",
46
+ "sence_indoor_0053",
47
+ "sence_indoor_0055",
48
+ "sence_indoor_0056",
49
+ "sence_indoor_0057",
50
+ "sence_indoor_0059",
51
+ "sence_indoor_0060",
52
+ "sence_indoor_0062",
53
+ "sence_indoor_0063",
54
+ "sence_indoor_0064",
55
+ "sence_indoor_0068",
56
+ "sence_indoor_0069",
57
+ "sence_indoor_0072",
58
+ "sence_indoor_0074",
59
+ "sence_indoor_0075",
60
+ "sence_indoor_0076",
61
+ "sence_indoor_0077",
62
+ "sence_indoor_0078",
63
+ "sence_indoor_0079",
64
+ "sence_indoor_0080",
65
+ "sence_indoor_0082",
66
+ "sence_indoor_0083",
67
+ "sence_indoor_0084",
68
+ "sence_indoor_0085",
69
+ "sence_indoor_0087",
70
+ "sence_indoor_0088",
71
+ "sence_indoor_0089",
72
+ "sence_indoor_0090",
73
+ "sence_indoor_0091",
74
+ "sence_indoor_0092",
75
+ "sence_indoor_0094",
76
+ "sence_indoor_0096",
77
+ "sence_indoor_0097",
78
+ "sence_indoor_0098",
79
+ "sence_indoor_0100",
80
+ "sence_indoor_0102",
81
+ "sence_indoor_0104",
82
+ "sence_indoor_0105",
83
+ "sence_indoor_0106",
84
+ "sence_indoor_0107",
85
+ "sence_indoor_0108",
86
+ "sence_indoor_0109",
87
+ "sence_indoor_0110",
88
+ "sence_indoor_0112",
89
+ "sence_indoor_0113",
90
+ "sence_indoor_0114",
91
+ "sence_indoor_0115",
92
+ "sence_indoor_0116",
93
+ "sence_indoor_0117",
94
+ "sence_indoor_0118",
95
+ "sence_indoor_0119",
96
+ "sence_indoor_0120",
97
+ "sence_indoor_0123",
98
+ "sence_indoor_0124",
99
+ "sence_indoor_0125",
100
+ "sence_indoor_0129",
101
+ "sence_indoor_0130",
102
+ "sence_indoor_0132",
103
+ "sence_indoor_0133",
104
+ "sence_indoor_0134",
105
+ "sence_indoor_0135",
106
+ "sence_indoor_0137",
107
+ "sence_indoor_0138",
108
+ "sence_indoor_0140",
109
+ "sence_indoor_0141",
110
+ "sence_indoor_0142",
111
+ "sence_indoor_0143",
112
+ "sence_indoor_0148",
113
+ "sence_indoor_0149",
114
+ "sence_indoor_0150",
115
+ "sence_indoor_0152",
116
+ "sence_indoor_0154",
117
+ "sence_indoor_0156",
118
+ "sence_indoor_0157",
119
+ "sence_indoor_0158",
120
+ "sence_indoor_0159",
121
+ "sence_indoor_0160",
122
+ "sence_indoor_0161",
123
+ "sence_indoor_0162",
124
+ "sence_indoor_0163",
125
+ "sence_indoor_0165",
126
+ "sence_indoor_0167",
127
+ "sence_indoor_0168",
128
+ "sence_indoor_0169",
129
+ "sence_indoor_0170",
130
+ "sence_indoor_0171",
131
+ "sence_indoor_0174",
132
+ "sence_indoor_0176",
133
+ "sence_indoor_0177",
134
+ "sence_indoor_0179",
135
+ "sence_indoor_0181",
136
+ "sence_indoor_0183",
137
+ "sence_indoor_0184",
138
+ "sence_indoor_0185",
139
+ "sence_indoor_0186",
140
+ "sence_indoor_0187",
141
+ "sence_indoor_0189",
142
+ "sence_indoor_0194",
143
+ "sence_indoor_0195",
144
+ "sence_indoor_0197",
145
+ "sence_indoor_0200",
146
+ "sence_indoor_0202",
147
+ "sence_indoor_0204",
148
+ "sence_indoor_0205",
149
+ "sence_indoor_0206",
150
+ "sence_indoor_0207",
151
+ "sence_indoor_0209",
152
+ "sence_indoor_0212",
153
+ "sence_indoor_0213",
154
+ "sence_indoor_0214",
155
+ "sence_indoor_0215",
156
+ "sence_indoor_0217",
157
+ "sence_indoor_0218",
158
+ "sence_indoor_0221",
159
+ "sence_indoor_0223",
160
+ "sence_indoor_0225",
161
+ "sence_indoor_0227",
162
+ "sence_indoor_0228",
163
+ "sence_indoor_0229",
164
+ "sence_indoor_0233",
165
+ "sence_indoor_0234",
166
+ "sence_indoor_0235",
167
+ "sence_indoor_0238",
168
+ "sence_indoor_0239",
169
+ "sence_indoor_0240",
170
+ "sence_indoor_0241",
171
+ "sence_indoor_0244",
172
+ "sence_indoor_0245",
173
+ "sence_indoor_0246",
174
+ "sence_indoor_0249",
175
+ "sence_indoor_0252",
176
+ "sence_indoor_0254",
177
+ "sence_indoor_0256",
178
+ "sence_indoor_0258",
179
+ "sence_indoor_0261",
180
+ "sence_indoor_0263",
181
+ "sence_indoor_0264",
182
+ "sence_indoor_0266",
183
+ "sence_indoor_0267",
184
+ "sence_indoor_0268",
185
+ "sence_indoor_0269",
186
+ "sence_indoor_0272",
187
+ "sence_indoor_0273",
188
+ "sence_indoor_0274",
189
+ "sence_indoor_0275",
190
+ "sence_indoor_0276",
191
+ "sence_indoor_0277",
192
+ "sence_indoor_0278",
193
+ "sence_indoor_0279",
194
+ "sence_indoor_0281",
195
+ "sence_indoor_0282",
196
+ "sence_indoor_0283",
197
+ "sence_indoor_0284",
198
+ "sence_indoor_0285",
199
+ "sence_indoor_0286",
200
+ "sence_indoor_0288",
201
+ "sence_indoor_0289",
202
+ "sence_indoor_0291",
203
+ "sence_indoor_0292",
204
+ "sence_indoor_0293",
205
+ "sence_indoor_0294",
206
+ "sence_indoor_0295",
207
+ "sence_indoor_0296",
208
+ "sence_indoor_0299",
209
+ "sence_indoor_0300",
210
+ "sence_indoor_0302",
211
+ "sence_indoor_0304",
212
+ "sence_indoor_0305",
213
+ "sence_indoor_0307",
214
+ "sence_indoor_0308",
215
+ "sence_indoor_0310",
216
+ "sence_indoor_0311",
217
+ "sence_indoor_0316",
218
+ "sence_indoor_0317",
219
+ "sence_indoor_0318",
220
+ "sence_indoor_0320",
221
+ "sence_indoor_0321",
222
+ "sence_indoor_0323",
223
+ "sence_indoor_0324",
224
+ "sence_indoor_0325",
225
+ "sence_indoor_0326",
226
+ "sence_indoor_0328",
227
+ "sence_indoor_0331",
228
+ "sence_indoor_0333",
229
+ "sence_indoor_0334",
230
+ "sence_indoor_0335",
231
+ "sence_indoor_0336",
232
+ "sence_indoor_0337",
233
+ "sence_indoor_0338",
234
+ "sence_indoor_0339",
235
+ "sence_indoor_0340",
236
+ "sence_indoor_0341",
237
+ "sence_indoor_0343",
238
+ "sence_indoor_0344",
239
+ "sence_indoor_0345",
240
+ "sence_indoor_0346",
241
+ "sence_indoor_0347",
242
+ "sence_indoor_0348",
243
+ "sence_indoor_0349",
244
+ "sence_indoor_0350",
245
+ "sence_indoor_0351",
246
+ "sence_indoor_0353",
247
+ "sence_indoor_0354",
248
+ "sence_indoor_0355",
249
+ "sence_indoor_0356",
250
+ "sence_indoor_0357",
251
+ "sence_indoor_0358",
252
+ "sence_indoor_0360",
253
+ "sence_indoor_0361",
254
+ "sence_indoor_0363",
255
+ "sence_indoor_0365",
256
+ "sence_indoor_0367",
257
+ "sence_indoor_0368",
258
+ "sence_indoor_0369",
259
+ "sence_indoor_0370",
260
+ "sence_indoor_0371",
261
+ "sence_indoor_0372",
262
+ "sence_indoor_0374"
263
+ ],
264
+ "val": [
265
+ "sence_indoor_0001",
266
+ "sence_indoor_0006",
267
+ "sence_indoor_0010",
268
+ "sence_indoor_0011",
269
+ "sence_indoor_0017",
270
+ "sence_indoor_0035",
271
+ "sence_indoor_0037",
272
+ "sence_indoor_0039",
273
+ "sence_indoor_0045",
274
+ "sence_indoor_0058",
275
+ "sence_indoor_0061",
276
+ "sence_indoor_0065",
277
+ "sence_indoor_0066",
278
+ "sence_indoor_0073",
279
+ "sence_indoor_0081",
280
+ "sence_indoor_0086",
281
+ "sence_indoor_0099",
282
+ "sence_indoor_0103",
283
+ "sence_indoor_0122",
284
+ "sence_indoor_0128",
285
+ "sence_indoor_0131",
286
+ "sence_indoor_0139",
287
+ "sence_indoor_0144",
288
+ "sence_indoor_0146",
289
+ "sence_indoor_0151",
290
+ "sence_indoor_0166",
291
+ "sence_indoor_0172",
292
+ "sence_indoor_0173",
293
+ "sence_indoor_0175",
294
+ "sence_indoor_0178",
295
+ "sence_indoor_0180",
296
+ "sence_indoor_0182",
297
+ "sence_indoor_0188",
298
+ "sence_indoor_0191",
299
+ "sence_indoor_0192",
300
+ "sence_indoor_0193",
301
+ "sence_indoor_0196",
302
+ "sence_indoor_0199",
303
+ "sence_indoor_0201",
304
+ "sence_indoor_0203",
305
+ "sence_indoor_0208",
306
+ "sence_indoor_0210",
307
+ "sence_indoor_0216",
308
+ "sence_indoor_0219",
309
+ "sence_indoor_0224",
310
+ "sence_indoor_0226",
311
+ "sence_indoor_0231",
312
+ "sence_indoor_0232",
313
+ "sence_indoor_0236",
314
+ "sence_indoor_0237",
315
+ "sence_indoor_0248",
316
+ "sence_indoor_0250",
317
+ "sence_indoor_0251",
318
+ "sence_indoor_0255",
319
+ "sence_indoor_0257",
320
+ "sence_indoor_0259",
321
+ "sence_indoor_0260",
322
+ "sence_indoor_0262",
323
+ "sence_indoor_0270",
324
+ "sence_indoor_0280",
325
+ "sence_indoor_0290",
326
+ "sence_indoor_0297",
327
+ "sence_indoor_0301",
328
+ "sence_indoor_0312",
329
+ "sence_indoor_0314",
330
+ "sence_indoor_0315",
331
+ "sence_indoor_0319",
332
+ "sence_indoor_0330",
333
+ "sence_indoor_0342",
334
+ "sence_indoor_0352",
335
+ "sence_indoor_0359",
336
+ "sence_indoor_0362",
337
+ "sence_indoor_0373"
338
+ ],
339
+ "test": [
340
+ "sence_indoor_0007",
341
+ "sence_indoor_0016",
342
+ "sence_indoor_0024",
343
+ "sence_indoor_0029",
344
+ "sence_indoor_0032",
345
+ "sence_indoor_0044",
346
+ "sence_indoor_0054",
347
+ "sence_indoor_0067",
348
+ "sence_indoor_0070",
349
+ "sence_indoor_0071",
350
+ "sence_indoor_0093",
351
+ "sence_indoor_0095",
352
+ "sence_indoor_0101",
353
+ "sence_indoor_0111",
354
+ "sence_indoor_0121",
355
+ "sence_indoor_0126",
356
+ "sence_indoor_0127",
357
+ "sence_indoor_0136",
358
+ "sence_indoor_0145",
359
+ "sence_indoor_0147",
360
+ "sence_indoor_0153",
361
+ "sence_indoor_0155",
362
+ "sence_indoor_0164",
363
+ "sence_indoor_0190",
364
+ "sence_indoor_0198",
365
+ "sence_indoor_0211",
366
+ "sence_indoor_0220",
367
+ "sence_indoor_0222",
368
+ "sence_indoor_0230",
369
+ "sence_indoor_0242",
370
+ "sence_indoor_0243",
371
+ "sence_indoor_0247",
372
+ "sence_indoor_0253",
373
+ "sence_indoor_0265",
374
+ "sence_indoor_0271",
375
+ "sence_indoor_0287",
376
+ "sence_indoor_0298",
377
+ "sence_indoor_0303",
378
+ "sence_indoor_0306",
379
+ "sence_indoor_0309",
380
+ "sence_indoor_0313",
381
+ "sence_indoor_0322",
382
+ "sence_indoor_0327",
383
+ "sence_indoor_0329",
384
+ "sence_indoor_0332",
385
+ "sence_indoor_0364",
386
+ "sence_indoor_0366"
387
+ ]
388
+ }
code/LICENSE ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Anonymous Authors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+
code/README.md ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # CM-EVS curator code (reviewer reference)
2
+
3
+ This directory mirrors the curator source code from the (anonymized) GitHub release. It's included here so reviewers can cross-reference implementation details against the paper without needing two URLs.
4
+
5
+ ## Layout
6
+
7
+ ```
8
+ code/
9
+ ├── core/ (curator core modules — coordinate, ERP projection / warping,
10
+ │ tangent extraction, depth fusion, …)
11
+ ├── scripts/ (per-step CLI scripts — build_candidates, select_views,
12
+ │ render_selected, evaluate_coverage, evaluate_oracle_gap,
13
+ │ audit_quality, run_tiny.sh, …)
14
+ ├── pipelines/ (per-source end-to-end runners — Blender, HM3D,
15
+ │ ScanNet++, full multi-source pipeline)
16
+ ├── tools/ (helper tools — make_sha256sums.sh,
17
+ │ update_croissant_with_real_hashes.py, …)
18
+ ├── configs/ (per-source YAML configs used by pipelines)
19
+ ├── metadata_examples/ (JSON schemas: candidates, selected_viewpoints,
20
+ │ per_step_log)
21
+ ├── examples/tiny_blender_scene/ (smoke-test fixture — run scripts/run_tiny.sh)
22
+ ├── dataset_metadata/ (croissant.json reference copy; same as top-level
23
+ │ ../croissant.json)
24
+ ├── environment.yml (conda environment)
25
+ ├── requirements.txt (pip fallback)
26
+ └── LICENSE (MIT)
27
+ ```
28
+
29
+ ## Quick start
30
+
31
+ ```bash
32
+ conda env create -f environment.yml
33
+ conda activate cmevs
34
+
35
+ # tiny smoke test (uses examples/tiny_blender_scene/)
36
+ bash scripts/run_tiny.sh
37
+
38
+ # real run:
39
+ python pipelines/run_blend_pipeline.py --config configs/blender_indoor.yaml
40
+ python pipelines/run_hm3d_pipeline.py --config configs/hm3d.yaml
41
+ python pipelines/run_ply_pipeline.py --config configs/scannetpp.yaml
42
+ ```
43
+
44
+ ## Mapping paper sections → code
45
+
46
+ | Paper section | Code |
47
+ | --- | --- |
48
+ | §3.1 Setup (candidates, budget, coverage) | `scripts/build_candidates.py`, `core/coordinate.py` |
49
+ | §3.2 Conflict-aware warping oracle | `core/erp_warp.py`, `scripts/selection_metrics.py` |
50
+ | §3.3 Pipeline three phases | `pipelines/run_blend_pipeline.py`, `run_hm3d_pipeline.py`, `run_ply_pipeline.py` |
51
+ | §3.4 Adapters (Table 2) | `pipelines/run_*_pipeline.py` per source |
52
+ | Algorithm 1 (greedy) | `scripts/select_views.py` |
53
+ | §3.6 Adaptive frame budgets (early stop) | `scripts/select_views.py` (`stop_gain`, `stop_score`, `stop_delta` flags) |
54
+ | §4.1 Output schema | `core/coordinate.py`, `core/erp_projection.py`, `metadata_examples/*.schema.json` |
55
+ | §4.8 per-frame quality | `scripts/audit_quality.py` |
56
+ | §5.1 Fixed-budget coverage | `scripts/evaluate_coverage.py` |
57
+ | §5.2 Warping oracle vs pre-render-all | `scripts/evaluate_oracle_gap.py` |
58
+ | §F.2 50-frame audit | `scripts/audit_quality.py` (extended audit mode) |
59
+
60
+ ## Reproducibility
61
+
62
+ All curator parameters that affect paper numbers are in `configs/*.yaml`. The reviewer can:
63
+
64
+ 1. Inspect each YAML to confirm parameter values match the paper.
65
+ 2. Run a smoke test against `examples/tiny_blender_scene/` to confirm the code executes end-to-end.
66
+ 3. Reproduce the full pipeline against actual data (Blender indoor frames are in `../blender_indoor/`; HM3D / ScanNet++ / outdoor data must be obtained from upstream).
67
+
68
+ ## License
69
+
70
+ MIT — see `LICENSE` and the top-level `../LICENSE.md` for the full per-component matrix.
code/README_REPRODUCE.md ADDED
@@ -0,0 +1,95 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Reproducibility Guide
2
+
3
+ This guide maps the code release to the experiments in the paper. The primary reproducibility path is Blender indoor; other sources are retained as secondary adapters for robustness checks.
4
+
5
+ ## Primary Asset Requirement
6
+
7
+ | Source | Expected Input | Primary Command |
8
+ | --- | --- | --- |
9
+ | Blender indoor | `.blend` scenes | `scripts/run_blender_indoor.sh` |
10
+
11
+ The repository does not redistribute scene assets. Reviewers can run the no-data smoke test immediately, and can run the full path after mounting local `.blend` scenes.
12
+
13
+ ## Secondary Assets
14
+
15
+ | Source | Expected Input | Config |
16
+ | --- | --- | --- |
17
+ | Blender outdoor / generic meshes | `.glb` or `.gltf` | `configs/blender_outdoor.yaml` |
18
+ | HM3D | `.glb` or `.gltf` plus optional semantic/navmesh files | `configs/hm3d.yaml` |
19
+ | ScanNet++ | `.ply` | `configs/scannetpp.yaml` |
20
+
21
+ ## Building Blocks Available in This Release
22
+
23
+ | Module | Purpose | Entry Point |
24
+ | --- | --- | --- |
25
+ | Candidate generation | Phase 1 of §3 — produce \(\mathcal{P}_\varphi\) | `scripts/build_candidates.py` |
26
+ | Conflict-aware selection | Phase 2 of §3 — greedy with \(s_t = G_t - \lambda L_t + \beta B_t\) | `scripts/select_views.py` |
27
+ | Selected-view rendering | Phase 3 — final ERP render from chosen candidates | `scripts/render_selected.py` |
28
+ | Coverage metric | §6.1 high-resolution oracle coverage | `scripts/evaluate_coverage.py` |
29
+ | Oracle-gain validation | §6.2 warping vs. pre-render-all comparison | `scripts/evaluate_oracle_gap.py` |
30
+ | Quality audit | Appendix F.2 50-frame audit | `scripts/audit_quality.py` |
31
+ | Run summarization | Aggregate per-scene `selected_frames.json` into a CSV | `scripts/summarize_blender_indoor_run.py` |
32
+ | Audit summarization | Aggregate per-frame audit results into a CSV | `scripts/summarize_quality_audit.py` |
33
+
34
+ The §6 driver scripts that orchestrate these building blocks across an entire baseline sweep (e.g., the `K\!\in\!\{8,16,24,32\}` table of §6.1, the \(\lambda\) sweep of §6.5, and the four-source benchmark of §6.6) are scheduled to be released alongside the camera-ready paper.
35
+
36
+ ## Minimal Review Run
37
+
38
+ ```bash
39
+ bash scripts/run_tiny.sh
40
+ ```
41
+
42
+ This validates the Blender-indoor-style metadata format, greedy selection loop, render-output contract, coverage metric, oracle-gap script, and quality audit script — end-to-end without any private scene assets.
43
+
44
+ ## Blender-Indoor Full Run
45
+
46
+ ```bash
47
+ DRY_RUN=1 \
48
+ BLENDER=/path/to/blender \
49
+ INPUT_DIR=/path/to/blend_scenes \
50
+ OUTPUT_ROOT=outputs/blender_indoor \
51
+ bash scripts/run_blender_indoor.sh
52
+ ```
53
+
54
+ After confirming the detected scene list, remove `DRY_RUN=1`:
55
+
56
+ ```bash
57
+ BLENDER=/path/to/blender \
58
+ INPUT_DIR=/path/to/blend_scenes \
59
+ OUTPUT_ROOT=outputs/blender_indoor \
60
+ NUM_FRAMES=30 \
61
+ RESOLUTION=2048,1024 \
62
+ GRID_SPACING=0.5 \
63
+ bash scripts/run_blender_indoor.sh
64
+ ```
65
+
66
+ ## Metric Scripts
67
+
68
+ The native Blender-indoor pipeline emits `selected_frames.json` under each scene output directory. Summarize a completed run with:
69
+
70
+ ```bash
71
+ python3 scripts/summarize_blender_indoor_run.py \
72
+ --output-root outputs/blender_indoor \
73
+ --output outputs/blender_indoor/results/coverage_main.csv
74
+ ```
75
+
76
+ If you have consolidated candidate and selection metadata into the normalized JSONL/JSON contract used by the smoke test, use:
77
+
78
+ ```bash
79
+ python3 scripts/evaluate_coverage.py \
80
+ --candidates outputs/blender_indoor/metadata/candidates.jsonl \
81
+ --selected outputs/blender_indoor/metadata/selected_viewpoints.json \
82
+ --output outputs/blender_indoor/results/coverage_main.csv
83
+
84
+ python3 scripts/evaluate_oracle_gap.py \
85
+ --candidates outputs/blender_indoor/metadata/candidates.jsonl \
86
+ --selected outputs/blender_indoor/metadata/selected_viewpoints.json \
87
+ --output outputs/blender_indoor/results/oracle_validation.csv
88
+
89
+ python3 scripts/audit_quality.py \
90
+ --render-dir outputs/blender_indoor/renders \
91
+ --metadata outputs/blender_indoor/metadata/selected_viewpoints.json \
92
+ --output outputs/blender_indoor/results/audit_50_frames.csv
93
+ ```
94
+
95
+ The exact dataset paths should be adapted to the local machine. Do not commit generated data, logs, checkpoints, third-party repositories, or scene assets to the anonymous code repository.
code/configs/base_erpt.yaml ADDED
@@ -0,0 +1,142 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # =============================================================================
2
+ # ERPT Pipeline Configuration(移植自原版 ERPT)
3
+ # 严格遵循 ERPT_native 坐标系约定:右手系 [X右, Y上, Z前]
4
+ # =============================================================================
5
+
6
+ # --- 数据路径 ---
7
+ data:
8
+ data_dir: "inputs"
9
+ output_dir: "outputs"
10
+ depth_dir: null # 可选:外部深度目录
11
+
12
+ # --- ERP 参数 ---
13
+ erp:
14
+ auto_size: true # 自动从图像检测尺寸
15
+ width: 4096 # 参考宽度
16
+ height: 2048 # 参考高度
17
+
18
+ # --- Tangent 切片参数(原版配置) ---
19
+ tangent:
20
+ scheme: "icosahedron"
21
+ num_faces: 20
22
+ add_poles: true
23
+ face_resolution: 768 # 每个 face 的分辨率(像素)
24
+ fov_deg: 90.0 # 普通 face 的基础 FOV(度)
25
+ padding_factor: 1.3 # 有效 FOV = 90 * 1.3 = 117°
26
+ pole_fov_deg: 160.0 # 极区切片使用更大 FOV
27
+ pole_resolution: 768 # 极区分辨率
28
+ pole_extra_rings: 2 # 额外极区密采样环数
29
+ seam_wrap: true
30
+
31
+ # --- Depth Pro 参数(原版配置) ---
32
+ depth_pro:
33
+ enabled: true
34
+ repo_dir: "third_party/ml-depth-pro"
35
+ checkpoint_path: "third_party/ml-depth-pro/checkpoints/depth_pro.pt"
36
+ precision: "fp16" # "fp32" | "fp16" | "bf16"
37
+ depth_def: "z" # "z" (z-depth) | "ray" (ray-depth)
38
+ pass_f_px: true # 传递已知焦距
39
+
40
+ # --- 深度融合参数(原版配置) ---
41
+ fusion:
42
+ blend_mode: "multiband" # "softmin_invdepth" | "multiband"
43
+ output_scale: 1.10 # 全局尺度校正
44
+
45
+ # 权重模式
46
+ weight_mode: "cosine"
47
+ k: 4 # cosine 权重指数
48
+
49
+ # 深度竞争
50
+ depth_competition: "softmin_invdepth"
51
+ softmin_alpha: 10.0
52
+
53
+ # 极区处理
54
+ pole_boost: false
55
+ pole_boost_factor: 1.5
56
+ pole_latitude_deg: 75.0
57
+ pole_ramp_deg: 10.0
58
+
59
+ pole_ring:
60
+ enabled: false
61
+ min_latitude_deg: 60.0
62
+ ramp_deg: 10.0
63
+
64
+ face_pole_suppress:
65
+ enabled: false
66
+ min_latitude_deg: 70.0
67
+ ramp_deg: 10.0
68
+ min_scale: 0.4
69
+
70
+ # 极区一致性校正
71
+ pole_consistency:
72
+ enabled: true
73
+ min_latitude_deg: 60.0
74
+ min_overlap_pixels: 4000
75
+ max_abs_log_shift: 0.7
76
+ ref_slice_types: ["face", "pole_ring"]
77
+ target_slice_types: ["pole_north", "pole_south"]
78
+
79
+ # Z-buffer 门限
80
+ project_zbuffer_eps_abs_m: 0.02
81
+ project_zbuffer_eps_rel: 0.02
82
+
83
+ # Multiband 金字塔
84
+ multiband:
85
+ levels: 6
86
+ highfreq_levels: 2
87
+ eps: 1.0e-6
88
+
89
+ # 有效性
90
+ min_weight_sum: 1.0e-6
91
+
92
+ # --- Warp 参数(原版配置) ---
93
+ warp:
94
+ enabled: true
95
+ center_frame: 0
96
+ target_frames: "auto" # "auto" 自动识别所有非中心帧;或指定列表如 [1, 2, 3]
97
+
98
+ # Splatting 方法
99
+ method: "softmax_splatting" # "softmax_splatting" | "zbuffer_splatting" | "zbuffer_point"
100
+ alpha: 2.0 # softmax 温度
101
+
102
+ # 自适应 Splat 半径
103
+ splat_radius_px: 1.5 # 基础半径
104
+ radius_min_px: 0.6 # 半径下限
105
+ radius_max_px: 2.2 # 中纬度上限
106
+ radius_max_pole_px: 3.4 # 极区上限
107
+ pole_radius_scale: 3.0 # 极区放大因子
108
+ pole_lat_threshold: 60.0 # 极区纬度阈值(度)
109
+ depth_radius_scale: false # 深度缩放
110
+ depth_ref_m: 2.0 # 深度参考值
111
+ depth_scale_factor: 1.0 # 深度已在 fusion.output_scale 烘焙
112
+ depth_edge_aware: true # 深度边缘感知
113
+ depth_edge_threshold: 0.3 # 深度梯度阈值
114
+ depth_edge_min_scale: 0.12 # 边缘处最小半径缩放
115
+
116
+ # 遮挡门控
117
+ occlusion_gate:
118
+ enabled: true
119
+ abs_eps_m: 0.05
120
+ rel_eps: 0.05
121
+
122
+ # Z-buffer 参数
123
+ zbuffer_eps_abs_m: 0.03
124
+ zbuffer_eps_rel: 0.03
125
+ zbuffer_min_weight: 0.001
126
+
127
+ # 空洞填充
128
+ hole_fill_enabled: false
129
+ max_hole_px: 16
130
+
131
+ # 有效性
132
+ min_weight_sum: 1.0e-4
133
+ min_hit_sum: 1.0e-6
134
+
135
+ # 输出控制
136
+ output_flow: true
137
+ output_depth: true
138
+
139
+ # --- 运行参数 ---
140
+ run:
141
+ device: "cuda"
142
+ save_intermediates: true
code/configs/blender_indoor.yaml ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ experiment:
2
+ source: blender_indoor
3
+ input_kind: blend
4
+
5
+ pipeline:
6
+ blender: /path/to/blender
7
+ input_dir: data/blender_indoor
8
+ output_root: outputs/blender_indoor
9
+ num_frames: 30
10
+ resolution: "2048,1024"
11
+ grid_spacing: 0.5
12
+ camera_height: null
13
+ min_frames: 5
14
+ stop_gain: 0.08
15
+ stop_score: -0.3
16
+ stop_delta: 0.08
17
+
code/configs/blender_outdoor.yaml ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ experiment:
2
+ source: blender_outdoor
3
+ input_kind: glb
4
+
5
+ pipeline:
6
+ blender: /path/to/blender
7
+ input_dir: data/blender_outdoor
8
+ output_root: outputs/blender_outdoor
9
+ num_frames: 30
10
+ resolution: "2048,1024"
11
+ grid_spacing: 1.0
12
+ camera_height: null
13
+ min_frames: 5
14
+ stop_gain: 0.08
15
+ stop_score: -0.3
16
+ stop_delta: 0.08
17
+
code/configs/default.yaml ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Default review configuration.
2
+ # The anonymous release is organized around the Blender-indoor path.
3
+
4
+ experiment:
5
+ source: blender_indoor
6
+ input_kind: blend
7
+ review_path: primary
8
+
9
+ pipeline:
10
+ blender: /path/to/blender
11
+ input_dir: data/blender_indoor
12
+ output_root: outputs/blender_indoor
13
+ num_frames: 30
14
+ resolution: "2048,1024"
15
+ grid_spacing: 0.5
16
+ camera_height: null
17
+ min_frames: 5
18
+ stop_gain: 0.08
19
+ stop_score: -0.3
20
+ stop_delta: 0.08
21
+ rotation_type: random_yaw
22
+
code/configs/hm3d.yaml ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ experiment:
2
+ source: hm3d
3
+ input_kind: glb
4
+
5
+ pipeline:
6
+ blender: /path/to/blender
7
+ input_dir: data/hm3d
8
+ output_root: outputs/hm3d
9
+ num_frames: 30
10
+ resolution: "2048,1024"
11
+ grid_spacing: 0.5
12
+ camera_height: null
13
+ min_frames: 5
14
+ stop_gain: 0.08
15
+ stop_score: -0.3
16
+ stop_delta: 0.08
17
+
code/configs/scannetpp.yaml ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ experiment:
2
+ source: scannetpp
3
+ input_kind: ply
4
+
5
+ pipeline:
6
+ input_dir: data/scannetpp
7
+ output_root: outputs/scannetpp
8
+ num_frames: 30
9
+ resolution: "2048,1024"
10
+ grid_spacing: 0.5
11
+ point_size: 2.0
12
+ z_up: true
13
+ min_frames: 5
14
+ stop_gain: 0.08
15
+ stop_score: -0.3
16
+ stop_delta: 0.08
17
+
code/configs/tiny.yaml ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ experiment:
2
+ name: blender_indoor_tiny_smoke_test
3
+ mode: blender_indoor_tiny
4
+ random_seed: 2026
5
+
6
+ selection:
7
+ budget: 4
8
+ lambda_conflict: 0.35
9
+ min_gain: 0.01
10
+
11
+ outputs:
12
+ root: outputs/tiny
13
+ metadata_dir: outputs/tiny/metadata
14
+ render_dir: outputs/tiny/renders
15
+ result_dir: outputs/tiny/results
code/core/__init__.py ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ ERPT Core 模块
3
+
4
+ 包含:
5
+ - tangent_extraction: ERP -> Tangent 切片生成
6
+ - depth_estimation: Depth Pro 深度估计
7
+ - depth_fusion: Tangent Depth -> ERP Depth 融合
8
+ - coordinate: 坐标系定义(锁定)
9
+ - erp_projection: ERP 投影(锁定)
10
+ """
11
+ from .tangent_extraction import (
12
+ TangentSlice,
13
+ build_icosahedron_slices,
14
+ extract_all_tangents,
15
+ extract_tangent_from_erp,
16
+ compute_coverage_mask,
17
+ compute_ray_directions_for_slice,
18
+ )
19
+
20
+ from .depth_estimation import (
21
+ DepthEstimator,
22
+ estimate_all_tangent_depths,
23
+ )
24
+
25
+ from .depth_fusion import (
26
+ fuse_tangent_depths_to_erp,
27
+ visualize_depth,
28
+ save_depth_visualization,
29
+ )
30
+
31
+ from .erp_warp import (
32
+ WarpResult,
33
+ warp_erp_to_target,
34
+ create_comparison_image,
35
+ )
code/core/coordinate.py ADDED
@@ -0,0 +1,191 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ 坐标系约定和四元数工具
3
+
4
+ ERPT_native 坐标系标准:
5
+ - 世界坐标系:右手系 [X右, Y上, Z前]
6
+ - 满足:X × Y = Z(右手法则)
7
+ - ERP投影约定:
8
+ - lon = atan2(x, z):经度,范围 [-π, π]
9
+ - lat = asin(y):纬度,范围 [-π/2, π/2]
10
+ - 图像中心(u=W/2, v=H/2)看向 +Z 方向
11
+ - 图像顶部是 +Y 方向(上)
12
+
13
+ 位姿格式:
14
+ - position: [x, y, z],相机中心在世界坐标系的位置(米)
15
+ - rotation_quaternion: [w, x, y, z],表示 camera->world 旋转 (R_cw)
16
+
17
+ 数学约定:
18
+ - P_world = R_cw @ P_cam + t(相机坐标系到世界坐标系)
19
+ - P_cam = R_wc @ (P_world - t)(世界坐标系到相机坐标系)
20
+ - R_wc = R_cw^T
21
+ """
22
+
23
+ import numpy as np
24
+ from typing import Tuple
25
+
26
+
27
+ def quat_wxyz_to_rotation_matrix(q: np.ndarray) -> np.ndarray:
28
+ """
29
+ 四元数转旋转矩阵
30
+
31
+ 输入四元数表示 camera->world 旋转 (R_cw)
32
+
33
+ Args:
34
+ q: (4,) 四元数 [w, x, y, z],需归一化
35
+
36
+ Returns:
37
+ R: (3, 3) 旋转矩阵 R_cw
38
+ """
39
+ q = np.asarray(q, dtype=np.float64).flatten()
40
+ assert q.shape == (4,), f"Expected shape (4,), got {q.shape}"
41
+
42
+ # 归一化
43
+ norm = np.linalg.norm(q)
44
+ if norm < 1e-9:
45
+ raise ValueError(f"Quaternion norm too small: {norm}")
46
+ q = q / norm
47
+
48
+ w, x, y, z = q[0], q[1], q[2], q[3]
49
+
50
+ # 旋转矩阵公式
51
+ R = np.array([
52
+ [1 - 2*(y*y + z*z), 2*(x*y - w*z), 2*(x*z + w*y)],
53
+ [2*(x*y + w*z), 1 - 2*(x*x + z*z), 2*(y*z - w*x)],
54
+ [2*(x*z - w*y), 2*(y*z + w*x), 1 - 2*(x*x + y*y)]
55
+ ], dtype=np.float64)
56
+
57
+ return R
58
+
59
+
60
+ def rotation_matrix_to_quat_wxyz(R: np.ndarray) -> np.ndarray:
61
+ """
62
+ 旋转矩阵转四元数
63
+
64
+ Args:
65
+ R: (3, 3) 旋转矩阵
66
+
67
+ Returns:
68
+ q: (4,) 四元数 [w, x, y, z]
69
+ """
70
+ R = np.asarray(R, dtype=np.float64).reshape(3, 3)
71
+
72
+ # 确保正交性(SVD正交化)
73
+ U, _, Vt = np.linalg.svd(R)
74
+ R = U @ Vt
75
+ if np.linalg.det(R) < 0:
76
+ U[:, -1] *= -1
77
+ R = U @ Vt
78
+
79
+ # Shepperd's method
80
+ trace = np.trace(R)
81
+
82
+ if trace > 0:
83
+ s = 2.0 * np.sqrt(trace + 1.0)
84
+ w = 0.25 * s
85
+ x = (R[2, 1] - R[1, 2]) / s
86
+ y = (R[0, 2] - R[2, 0]) / s
87
+ z = (R[1, 0] - R[0, 1]) / s
88
+ elif R[0, 0] > R[1, 1] and R[0, 0] > R[2, 2]:
89
+ s = 2.0 * np.sqrt(1.0 + R[0, 0] - R[1, 1] - R[2, 2])
90
+ w = (R[2, 1] - R[1, 2]) / s
91
+ x = 0.25 * s
92
+ y = (R[0, 1] + R[1, 0]) / s
93
+ z = (R[0, 2] + R[2, 0]) / s
94
+ elif R[1, 1] > R[2, 2]:
95
+ s = 2.0 * np.sqrt(1.0 + R[1, 1] - R[0, 0] - R[2, 2])
96
+ w = (R[0, 2] - R[2, 0]) / s
97
+ x = (R[0, 1] + R[1, 0]) / s
98
+ y = 0.25 * s
99
+ z = (R[1, 2] + R[2, 1]) / s
100
+ else:
101
+ s = 2.0 * np.sqrt(1.0 + R[2, 2] - R[0, 0] - R[1, 1])
102
+ w = (R[1, 0] - R[0, 1]) / s
103
+ x = (R[0, 2] + R[2, 0]) / s
104
+ y = (R[1, 2] + R[2, 1]) / s
105
+ z = 0.25 * s
106
+
107
+ q = np.array([w, x, y, z], dtype=np.float64)
108
+
109
+ # 归一化
110
+ q = q / np.linalg.norm(q)
111
+
112
+ # 确保 w >= 0(唯一性)
113
+ if q[0] < 0:
114
+ q = -q
115
+
116
+ return q
117
+
118
+
119
+ def R_cw_to_R_wc(R_cw: np.ndarray) -> np.ndarray:
120
+ """
121
+ camera->world 旋转矩阵转换为 world->camera
122
+
123
+ R_wc = R_cw^T
124
+
125
+ Args:
126
+ R_cw: (3, 3) camera->world 旋转矩阵
127
+
128
+ Returns:
129
+ R_wc: (3, 3) world->camera 旋转矩阵
130
+ """
131
+ return R_cw.T
132
+
133
+
134
+ def R_wc_to_R_cw(R_wc: np.ndarray) -> np.ndarray:
135
+ """
136
+ world->camera 旋转矩阵转换为 camera->world
137
+
138
+ R_cw = R_wc^T
139
+
140
+ Args:
141
+ R_wc: (3, 3) world->camera 旋转矩阵
142
+
143
+ Returns:
144
+ R_cw: (3, 3) camera->world 旋转矩阵
145
+ """
146
+ return R_wc.T
147
+
148
+
149
+ def validate_rotation_matrix(R: np.ndarray, tol: float = 1e-5) -> Tuple[bool, str]:
150
+ """
151
+ 验证旋转矩阵的有效性
152
+
153
+ Args:
154
+ R: (3, 3) 待验证的矩阵
155
+ tol: 容差
156
+
157
+ Returns:
158
+ (is_valid, message)
159
+ """
160
+ R = np.asarray(R, dtype=np.float64).reshape(3, 3)
161
+
162
+ # 检查正交性:R^T @ R = I
163
+ I = R.T @ R
164
+ orth_err = np.max(np.abs(I - np.eye(3)))
165
+ if orth_err > tol:
166
+ return False, f"Orthogonality error: {orth_err:.6e} > {tol}"
167
+
168
+ # 检查行列式:det(R) = +1
169
+ det = np.linalg.det(R)
170
+ if np.abs(det - 1.0) > tol:
171
+ return False, f"Determinant error: det(R)={det:.6f}, expected 1.0"
172
+
173
+ return True, "Valid rotation matrix"
174
+
175
+
176
+ def orthonormalize_rotation(R: np.ndarray) -> np.ndarray:
177
+ """
178
+ 使用SVD正交化旋转矩阵
179
+
180
+ Args:
181
+ R: (3, 3) 近似旋转矩阵
182
+
183
+ Returns:
184
+ R_orth: (3, 3) 正交化后的旋转矩阵
185
+ """
186
+ U, _, Vt = np.linalg.svd(R)
187
+ R_orth = U @ Vt
188
+ if np.linalg.det(R_orth) < 0:
189
+ U[:, -1] *= -1
190
+ R_orth = U @ Vt
191
+ return R_orth
code/core/depth_estimation.py ADDED
@@ -0,0 +1,185 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ Depth Pro Wrapper(移植自原版 ERPT)
3
+
4
+ 封装 Apple Depth Pro 单目深度估计模型。
5
+
6
+ API 使用说明:
7
+ 1. 使用 depth_pro.create_model_and_transforms() 创建模型和预处理 transforms
8
+ 2. 输入 RGB 图像 (PIL Image 或 numpy array)
9
+ 3. 调用 model.infer(image, f_px=focal_length) 得到深度
10
+ 4. 输出 depth 单位为米 (m)
11
+
12
+ 深度定义:
13
+ - Depth Pro 输出的是透视相机的 z-depth (沿相机前向轴的深度)
14
+ """
15
+ from __future__ import annotations
16
+
17
+ import os
18
+ import sys
19
+ from pathlib import Path
20
+ from typing import Any, Dict, List, Optional, Tuple
21
+
22
+ import numpy as np
23
+ import torch
24
+ from PIL import Image
25
+
26
+ from .tangent_extraction import TangentSlice
27
+
28
+ # 模型缓存,避免重复加载
29
+ _MODEL_CACHE: Dict[str, Tuple[torch.nn.Module, Any]] = {}
30
+
31
+
32
+ def _get_precision(cfg: Dict[str, Any]) -> torch.dtype:
33
+ """获取计算精度"""
34
+ prec = cfg.get("depth_pro", {}).get("precision", "fp16")
35
+ if prec == "fp16":
36
+ return torch.float16
37
+ elif prec == "bf16":
38
+ return torch.bfloat16
39
+ return torch.float32
40
+
41
+
42
+ def _load_depthpro_model(
43
+ cfg: Dict[str, Any],
44
+ device: torch.device,
45
+ ) -> Tuple[torch.nn.Module, Any]:
46
+ """
47
+ 加载 Depth Pro 模型和 transforms
48
+
49
+ Depth Pro 默认从 ./checkpoints/depth_pro.pt 加载权重,
50
+ 因此需要切换到 repo 目录加载模型。
51
+ """
52
+ dcfg = cfg.get("depth_pro", {})
53
+
54
+ # 获取 Depth Pro 仓库目录
55
+ repo_dir = Path(dcfg.get("repo_dir", "third_party/ml-depth-pro"))
56
+ if not repo_dir.is_absolute():
57
+ root = Path(str(cfg.get("_project_root", Path.cwd())))
58
+ repo_dir = root / repo_dir
59
+
60
+ checkpoint_path = repo_dir / "checkpoints" / "depth_pro.pt"
61
+
62
+ precision = _get_precision(cfg)
63
+ cache_key = f"{checkpoint_path}_{device}_{precision}"
64
+
65
+ if cache_key in _MODEL_CACHE:
66
+ return _MODEL_CACHE[cache_key]
67
+
68
+ # 添加 Depth Pro 路径到 sys.path
69
+ if repo_dir.exists():
70
+ src_path = str(repo_dir / "src")
71
+ if src_path not in sys.path:
72
+ sys.path.insert(0, src_path)
73
+ if str(repo_dir) not in sys.path:
74
+ sys.path.insert(0, str(repo_dir))
75
+
76
+ try:
77
+ import depth_pro
78
+ except ImportError as e:
79
+ raise RuntimeError(
80
+ f"Failed to import depth_pro module. "
81
+ f"Please ensure ml-depth-pro is installed at {repo_dir}\n"
82
+ f"Error: {e}"
83
+ ) from e
84
+
85
+ if not checkpoint_path.exists():
86
+ raise FileNotFoundError(
87
+ f"Depth Pro checkpoint not found: {checkpoint_path}\n"
88
+ f"Please place depth_pro.pt in {checkpoint_path.parent}"
89
+ )
90
+
91
+ print(f"[DepthPro] Loading model from {checkpoint_path}")
92
+ print(f"[DepthPro] Device: {device}, Precision: {precision}")
93
+
94
+ # 保存当前目录并切换到 repo_dir(Depth Pro 默认从 ./checkpoints 加载)
95
+ original_cwd = os.getcwd()
96
+ try:
97
+ os.chdir(repo_dir)
98
+
99
+ # 使用官方 API 加载模型
100
+ model, transform = depth_pro.create_model_and_transforms(
101
+ device=device,
102
+ precision=precision,
103
+ )
104
+
105
+ model.eval()
106
+ print(f"[DepthPro] Model loaded successfully")
107
+
108
+ finally:
109
+ os.chdir(original_cwd)
110
+
111
+ _MODEL_CACHE[cache_key] = (model, transform)
112
+ return model, transform
113
+
114
+
115
+ class DepthEstimator:
116
+ """
117
+ Depth Pro 深度估计器封装类
118
+
119
+ 提供统一的接口用于批量深度估计。
120
+ """
121
+
122
+ def __init__(self, cfg: Dict[str, Any], device: torch.device):
123
+ self.cfg = cfg
124
+ self.device = device
125
+ self.model, self.transform = _load_depthpro_model(cfg, device)
126
+ self.pass_f_px = bool(cfg.get("depth_pro", {}).get("pass_f_px", True))
127
+
128
+ @torch.no_grad()
129
+ def predict_single(self, rgb: np.ndarray, f_px: Optional[float] = None) -> np.ndarray:
130
+ """
131
+ 单张图像深度预测
132
+
133
+ Args:
134
+ rgb: (H, W, 3) uint8 numpy array
135
+ f_px: 可选的 focal length (像素)
136
+
137
+ Returns:
138
+ (H, W) float32 numpy array, 单位米
139
+ """
140
+ pil_img = Image.fromarray(rgb.astype(np.uint8))
141
+ img_tensor = self.transform(pil_img)
142
+
143
+ f_px_tensor = None
144
+ if f_px is not None and self.pass_f_px:
145
+ f_px_tensor = torch.tensor([f_px], device=self.device)
146
+
147
+ prediction = self.model.infer(img_tensor, f_px=f_px_tensor)
148
+ return prediction["depth"].detach().cpu().float().numpy().astype(np.float32)
149
+
150
+
151
+ def estimate_all_tangent_depths(
152
+ tangent_rgbs: Dict[str, np.ndarray],
153
+ slices: List[TangentSlice],
154
+ cfg: Dict[str, Any],
155
+ device: torch.device,
156
+ ) -> Dict[str, np.ndarray]:
157
+ """
158
+ 对所有切片估计深度
159
+
160
+ Args:
161
+ tangent_rgbs: {slice_id: rgb_array} 字典
162
+ slices: 切片规格列表
163
+ cfg: 配置字典
164
+ device: 计算设备
165
+
166
+ Returns:
167
+ tangent_depths: {slice_id: depth_array} 字典
168
+ """
169
+ estimator = DepthEstimator(cfg, device)
170
+
171
+ # 建立 slice_id -> f_px 映射
172
+ f_px_map = {s.slice_id: s.f_px for s in slices}
173
+
174
+ results = {}
175
+ total = len(tangent_rgbs)
176
+
177
+ for i, (slice_id, rgb) in enumerate(tangent_rgbs.items()):
178
+ f_px = f_px_map.get(slice_id)
179
+ depth = estimator.predict_single(rgb, f_px=f_px)
180
+ results[slice_id] = depth
181
+
182
+ print(f" [{i+1}/{total}] {slice_id}: "
183
+ f"depth range [{depth.min():.2f}, {depth.max():.2f}] m")
184
+
185
+ return results
code/core/depth_fusion.py ADDED
@@ -0,0 +1,769 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ Tangent Depth -> ERP Depth 融合模块(完整移植自原版 ERPT)
3
+
4
+ 核心功能:
5
+ 1. 将每个切片的深度回投影到 ERP
6
+ 2. 使用 cosine 权重实现平滑融合(无块状边界)
7
+ 3. 使用 softmin(1/depth) 处理重叠区深度竞争
8
+ 4. 极区增强处理
9
+ 5. Multiband 金字塔融合(消除接缝)
10
+ 6. Pole consistency 极区深度对齐
11
+ 7. Z-buffer 门控投影(保持边缘锐利)
12
+
13
+ 关键算法:
14
+ - Cosine 权重: w_face = max(0, dot(ray, face_center))^k
15
+ - Depth 竞争: softmin(1/depth) 确保近处优先且平滑过渡
16
+ - Forward splatting 将切片像素投影到 ERP
17
+ - Multiband: Gaussian/Laplacian 金字塔融合
18
+
19
+ 输出:
20
+ - depth_range: ERP range depth (float32, meters)
21
+ - weight_sum: 权重和(用于 debug)
22
+ - valid_mask: 有效掩码
23
+ """
24
+ from __future__ import annotations
25
+
26
+ import math
27
+ from pathlib import Path
28
+ from typing import Any, Dict, List, Optional, Tuple
29
+
30
+ import numpy as np
31
+ import torch
32
+
33
+ from .tangent_extraction import TangentSlice
34
+
35
+
36
+ # =============================================================================
37
+ # 基础工具函数
38
+ # =============================================================================
39
+
40
+ def compute_cosine_weight(
41
+ ray_dirs: torch.Tensor,
42
+ face_center: torch.Tensor,
43
+ k: float = 4.0,
44
+ ) -> torch.Tensor:
45
+ """
46
+ 计算 cosine 权重: w = max(0, dot(ray, face_center))^k
47
+ """
48
+ dots = torch.sum(ray_dirs * face_center.view(1, 1, 3), dim=-1)
49
+ weights = torch.clamp(dots, min=0.0) ** k
50
+ return weights
51
+
52
+
53
+ def _dirs_to_erp_uv(
54
+ dirs_world: torch.Tensor,
55
+ erp_h: int,
56
+ erp_w: int,
57
+ ) -> Tuple[torch.Tensor, torch.Tensor]:
58
+ """将世界坐标方向转换为 ERP 像素坐标"""
59
+ x = dirs_world[..., 0]
60
+ y = dirs_world[..., 1]
61
+ z = dirs_world[..., 2]
62
+
63
+ lon = torch.atan2(x, z)
64
+ lat = torch.asin(torch.clamp(y, -1.0, 1.0))
65
+
66
+ u = (lon + math.pi) / (2.0 * math.pi) * float(erp_w)
67
+ u = torch.remainder(u, float(erp_w))
68
+ v = (math.pi / 2.0 - lat) / math.pi * float(erp_h - 1)
69
+ v = torch.clamp(v, 0.0, float(erp_h - 1))
70
+
71
+ return u, v
72
+
73
+
74
+ # =============================================================================
75
+ # 极区权重处理
76
+ # =============================================================================
77
+
78
+ def _apply_pole_weights(
79
+ slice_type: str,
80
+ dirs_world: torch.Tensor,
81
+ base_weight: torch.Tensor,
82
+ fusion_cfg: Dict[str, Any],
83
+ ) -> torch.Tensor:
84
+ """极区权重门控与增强"""
85
+ # pole_ring gating
86
+ pole_ring_cfg = fusion_cfg.get("pole_ring", {})
87
+ pole_ring_enabled = bool(pole_ring_cfg.get("enabled", True))
88
+ pole_ring_min_lat_deg = float(pole_ring_cfg.get("min_latitude_deg", 60.0))
89
+ pole_ring_ramp_deg = float(pole_ring_cfg.get("ramp_deg", 10.0))
90
+
91
+ if slice_type == "pole_ring":
92
+ if not pole_ring_enabled:
93
+ return torch.zeros_like(base_weight)
94
+ lat = torch.asin(torch.clamp(dirs_world[..., 1], -1.0, 1.0)) * (180.0 / math.pi)
95
+ abs_lat = torch.abs(lat)
96
+ ramp = torch.clamp(
97
+ (abs_lat - pole_ring_min_lat_deg) / max(pole_ring_ramp_deg, 1e-3),
98
+ min=0.0, max=1.0,
99
+ )
100
+ return base_weight * ramp
101
+
102
+ # pole caps progressive boost
103
+ pole_boost = bool(fusion_cfg.get("pole_boost", True))
104
+ pole_boost_factor = float(fusion_cfg.get("pole_boost_factor", 1.5))
105
+ pole_latitude_deg = float(fusion_cfg.get("pole_latitude_deg", 75.0))
106
+ pole_ramp_deg = float(fusion_cfg.get("pole_ramp_deg", 10.0))
107
+
108
+ if pole_boost and slice_type in ("pole_north", "pole_south"):
109
+ lat = torch.asin(torch.clamp(dirs_world[..., 1], -1.0, 1.0)) * (180.0 / math.pi)
110
+ abs_lat = torch.abs(lat)
111
+ ramp = torch.clamp(
112
+ (abs_lat - pole_latitude_deg) / max(pole_ramp_deg, 1e-3),
113
+ min=0.0, max=1.0,
114
+ )
115
+ mult = 1.0 + ramp * (pole_boost_factor - 1.0)
116
+ return base_weight * mult
117
+
118
+ # faces 在极区衰减
119
+ face_pole_cfg = fusion_cfg.get("face_pole_suppress", {})
120
+ if slice_type == "face" and bool(face_pole_cfg.get("enabled", True)):
121
+ min_lat = float(face_pole_cfg.get("min_latitude_deg", 70.0))
122
+ ramp_deg = float(face_pole_cfg.get("ramp_deg", 10.0))
123
+ min_scale = float(face_pole_cfg.get("min_scale", 0.4))
124
+ lat = torch.asin(torch.clamp(dirs_world[..., 1], -1.0, 1.0)) * (180.0 / math.pi)
125
+ abs_lat = torch.abs(lat)
126
+ t = torch.clamp((abs_lat - min_lat) / max(ramp_deg, 1e-3), 0.0, 1.0)
127
+ scale = 1.0 - t * (1.0 - min_scale)
128
+ return base_weight * scale
129
+
130
+ return base_weight
131
+
132
+
133
+ # =============================================================================
134
+ # Forward splatting(softmin_invdepth 模式用)
135
+ # =============================================================================
136
+
137
+ def _forward_splat(
138
+ erp_h: int,
139
+ erp_w: int,
140
+ u: torch.Tensor,
141
+ v: torch.Tensor,
142
+ range_depth: torch.Tensor,
143
+ weight: torch.Tensor,
144
+ accum_weighted_invdepth: torch.Tensor,
145
+ accum_weight: torch.Tensor,
146
+ depth_competition: str,
147
+ softmin_alpha: float,
148
+ pole_boost: bool,
149
+ pole_boost_factor: float,
150
+ pole_latitude_deg: float,
151
+ ) -> None:
152
+ """Forward splatting with bilinear interpolation"""
153
+ u_flat = u.reshape(-1)
154
+ v_flat = v.reshape(-1)
155
+ d_flat = range_depth.reshape(-1)
156
+ w_flat = weight.reshape(-1)
157
+
158
+ valid = torch.isfinite(d_flat) & (d_flat > 0.0) & torch.isfinite(w_flat) & (w_flat > 0.0)
159
+
160
+ u0 = torch.floor(u_flat).to(torch.int64)
161
+ v0 = torch.floor(v_flat).to(torch.int64)
162
+ du = (u_flat - u0.to(u_flat.dtype)).clamp(0.0, 1.0)
163
+ dv = (v_flat - v0.to(v_flat.dtype)).clamp(0.0, 1.0)
164
+
165
+ u0_wrap = torch.remainder(u0, erp_w)
166
+ u1_wrap = torch.remainder(u0 + 1, erp_w)
167
+ v1 = v0 + 1
168
+
169
+ w00 = (1.0 - du) * (1.0 - dv)
170
+ w10 = du * (1.0 - dv)
171
+ w01 = (1.0 - du) * dv
172
+ w11 = du * dv
173
+
174
+ if depth_competition == "softmin_invdepth":
175
+ inv_depth = 1.0 / torch.clamp(d_flat, min=1e-6)
176
+ value_to_splat = inv_depth
177
+ elif depth_competition == "softmax_negdepth":
178
+ exp_weight = torch.exp(-softmin_alpha * d_flat)
179
+ w_flat = w_flat * exp_weight
180
+ value_to_splat = d_flat
181
+ else:
182
+ value_to_splat = d_flat
183
+
184
+ def _add(u_idx, v_idx, bilinear_w):
185
+ v_ok = (v_idx >= 0) & (v_idx < erp_h)
186
+ m = valid & v_ok
187
+ u_safe = torch.where(m, u_idx, torch.zeros_like(u_idx))
188
+ v_safe = torch.where(m, v_idx, torch.zeros_like(v_idx))
189
+ idx = v_safe * erp_w + u_safe
190
+ final_w = torch.where(m, bilinear_w * w_flat, torch.zeros_like(bilinear_w))
191
+ final_val = torch.where(m, bilinear_w * w_flat * value_to_splat, torch.zeros_like(bilinear_w))
192
+ accum_weight.scatter_add_(0, idx, final_w)
193
+ accum_weighted_invdepth.scatter_add_(0, idx, final_val)
194
+
195
+ _add(u0_wrap, v0, w00)
196
+ _add(u1_wrap, v0, w10)
197
+ _add(u0_wrap, v1, w01)
198
+ _add(u1_wrap, v1, w11)
199
+
200
+
201
+ # =============================================================================
202
+ # Z-buffer 门控投影(multiband 模式用)
203
+ # =============================================================================
204
+
205
+ def _project_slice_to_erp_disp_weight_zbuffer(
206
+ depth_t: torch.Tensor,
207
+ slice_spec: TangentSlice,
208
+ cfg: Dict[str, Any],
209
+ erp_h: int,
210
+ erp_w: int,
211
+ depth_def: str,
212
+ k: float,
213
+ device: torch.device,
214
+ ) -> Tuple[torch.Tensor, torch.Tensor]:
215
+ """
216
+ 将单个切片投影到 ERP,输出 disparity(1/range) 与 weight。
217
+ 采用 per-slice z-buffer(min depth)避免同一 slice 内的边缘被平均糊掉。
218
+ """
219
+ fusion_cfg = cfg.get("fusion", {})
220
+ weight_mode = str(fusion_cfg.get("weight_mode", "cosine"))
221
+
222
+ res = slice_spec.resolution
223
+ K = slice_spec.K
224
+ R_cw = slice_spec.R_cw
225
+
226
+ fx, fy = float(K[0, 0]), float(K[1, 1])
227
+ cx, cy = float(K[0, 2]), float(K[1, 2])
228
+
229
+ xs = torch.arange(res, device=device, dtype=torch.float32)
230
+ ys = torch.arange(res, device=device, dtype=torch.float32)
231
+ yv, xv = torch.meshgrid(ys, xs, indexing="ij")
232
+
233
+ x_cam = (xv - cx) / fx
234
+ y_cam = -(yv - cy) / fy
235
+ z_cam = torch.ones_like(x_cam)
236
+
237
+ dirs_cam = torch.stack([x_cam, y_cam, z_cam], dim=-1)
238
+ ray_len = torch.norm(dirs_cam, dim=-1, keepdim=True).clamp(min=1e-9)
239
+ dirs_cam = dirs_cam / ray_len
240
+
241
+ R = torch.tensor(R_cw, device=device, dtype=torch.float32)
242
+ dirs_world = torch.einsum("ij,hwj->hwi", R, dirs_cam)
243
+
244
+ # range depth
245
+ if depth_def == "z":
246
+ range_depth = depth_t * ray_len.squeeze(-1)
247
+ else:
248
+ range_depth = depth_t
249
+
250
+ u, v = _dirs_to_erp_uv(dirs_world, erp_h, erp_w)
251
+
252
+ if weight_mode == "cosine":
253
+ face_center = torch.tensor(slice_spec.center_dir, device=device, dtype=torch.float32)
254
+ base_w = compute_cosine_weight(dirs_world, face_center, k=k)
255
+ else:
256
+ base_w = torch.ones_like(range_depth)
257
+
258
+ base_w = _apply_pole_weights(slice_spec.slice_type, dirs_world, base_w, fusion_cfg)
259
+
260
+ u_flat = u.reshape(-1)
261
+ v_flat = v.reshape(-1)
262
+ d_flat = range_depth.reshape(-1)
263
+ w_flat = base_w.reshape(-1)
264
+
265
+ valid = torch.isfinite(d_flat) & (d_flat > 0.0) & torch.isfinite(w_flat) & (w_flat > 0.0)
266
+
267
+ u0 = torch.floor(u_flat).to(torch.int64)
268
+ v0 = torch.floor(v_flat).to(torch.int64)
269
+ du = (u_flat - u0.float()).clamp(0.0, 1.0)
270
+ dv = (v_flat - v0.float()).clamp(0.0, 1.0)
271
+
272
+ u0w = torch.remainder(u0, erp_w)
273
+ u1w = torch.remainder(u0 + 1, erp_w)
274
+ v1 = v0 + 1
275
+
276
+ bw00 = (1.0 - du) * (1.0 - dv)
277
+ bw10 = du * (1.0 - dv)
278
+ bw01 = (1.0 - du) * dv
279
+ bw11 = du * dv
280
+
281
+ # Pass A: min depth
282
+ min_depth = torch.full((erp_h * erp_w,), float("inf"), device=device, dtype=torch.float32)
283
+
284
+ def _amin(ui, vi, bw):
285
+ m = valid & (vi >= 0) & (vi < erp_h)
286
+ ui_safe = torch.where(m, ui, torch.zeros_like(ui))
287
+ vi_safe = torch.where(m, vi, torch.zeros_like(vi))
288
+ idx = vi_safe * erp_w + ui_safe
289
+ cand = torch.where(m, d_flat, torch.full_like(d_flat, float("inf")))
290
+ min_depth.scatter_reduce_(0, idx, cand, reduce="amin", include_self=True)
291
+
292
+ _amin(u0w, v0, bw00)
293
+ _amin(u1w, v0, bw10)
294
+ _amin(u0w, v1, bw01)
295
+ _amin(u1w, v1, bw11)
296
+
297
+ # Pass B: accumulate disparity near min depth
298
+ disp_acc = torch.zeros(erp_h * erp_w, device=device, dtype=torch.float32)
299
+ w_acc = torch.zeros(erp_h * erp_w, device=device, dtype=torch.float32)
300
+
301
+ eps_abs = float(fusion_cfg.get("project_zbuffer_eps_abs_m", 0.02))
302
+ eps_rel = float(fusion_cfg.get("project_zbuffer_eps_rel", 0.02))
303
+
304
+ inv_d = 1.0 / torch.clamp(d_flat, min=1e-6)
305
+
306
+ def _acc(ui, vi, bw):
307
+ m = valid & (vi >= 0) & (vi < erp_h)
308
+ ui_safe = torch.where(m, ui, torch.zeros_like(ui))
309
+ vi_safe = torch.where(m, vi, torch.zeros_like(vi))
310
+ idx = vi_safe * erp_w + ui_safe
311
+ md = min_depth.gather(0, idx)
312
+ gate = d_flat <= (md * (1.0 + eps_rel) + eps_abs)
313
+ mm = m & gate
314
+ w_here = torch.where(mm, bw * w_flat, torch.zeros_like(bw))
315
+ disp_here = torch.where(mm, w_here * inv_d, torch.zeros_like(w_here))
316
+ w_acc.scatter_add_(0, idx, w_here)
317
+ disp_acc.scatter_add_(0, idx, disp_here)
318
+
319
+ _acc(u0w, v0, bw00)
320
+ _acc(u1w, v0, bw10)
321
+ _acc(u0w, v1, bw01)
322
+ _acc(u1w, v1, bw11)
323
+
324
+ w_map = w_acc.view(erp_h, erp_w)
325
+ disp_map = torch.zeros_like(w_map)
326
+ m = w_map > 1e-9
327
+ disp_map[m] = disp_acc.view(erp_h, erp_w)[m] / w_map[m]
328
+ return disp_map, w_map
329
+
330
+
331
+ # =============================================================================
332
+ # Multiband 金字塔工具
333
+ # =============================================================================
334
+
335
+ def _pad_circular_w(x: torch.Tensor, pad: int) -> torch.Tensor:
336
+ if pad <= 0:
337
+ return x
338
+ return torch.cat([x[..., -pad:], x, x[..., :pad]], dim=-1)
339
+
340
+
341
+ def _gauss5_kernel(device: torch.device, dtype: torch.dtype) -> torch.Tensor:
342
+ k1 = torch.tensor([1.0, 4.0, 6.0, 4.0, 1.0], device=device, dtype=dtype)
343
+ k1 = k1 / k1.sum()
344
+ k2 = (k1[:, None] * k1[None, :]).view(1, 1, 5, 5)
345
+ return k2
346
+
347
+
348
+ def _blur_circular_w(x: torch.Tensor, kernel: torch.Tensor) -> torch.Tensor:
349
+ import torch.nn.functional as F
350
+ pad = kernel.shape[-1] // 2
351
+ xw = _pad_circular_w(x, pad)
352
+ xwh = F.pad(xw, (0, 0, pad, pad), mode="reflect")
353
+ return F.conv2d(xwh, kernel)
354
+
355
+
356
+ def _down2(x: torch.Tensor) -> torch.Tensor:
357
+ return x[..., ::2, ::2]
358
+
359
+
360
+ def _upsample2_circular_w(x: torch.Tensor, out_h: int, out_w: int) -> torch.Tensor:
361
+ import torch.nn.functional as F
362
+ x3 = torch.cat([x, x, x], dim=-1)
363
+ y3 = F.interpolate(x3, size=(out_h, out_w * 3), mode="bilinear", align_corners=False)
364
+ return y3[..., out_w: 2 * out_w]
365
+
366
+
367
+ # =============================================================================
368
+ # 主融合函数
369
+ # =============================================================================
370
+
371
+ @torch.no_grad()
372
+ def fuse_tangent_depths_to_erp(
373
+ tangent_depths: Dict[str, np.ndarray],
374
+ slices: List[TangentSlice],
375
+ cfg: Dict[str, Any],
376
+ device: torch.device,
377
+ debug_dir: Optional[Path] = None,
378
+ ) -> Tuple[np.ndarray, np.ndarray, np.ndarray]:
379
+ """
380
+ 将所有切片深度融合为 ERP range depth
381
+
382
+ Args:
383
+ tangent_depths: {slice_id: depth_array}
384
+ slices: 切片规格列表
385
+ cfg: 配置字典
386
+ device: 计算设备
387
+
388
+ Returns:
389
+ depth_range: (erp_h, erp_w) ERP range depth, float32
390
+ weight_sum: (erp_h, erp_w) 权重和
391
+ valid_mask: (erp_h, erp_w) uint8
392
+ """
393
+ erp_cfg = cfg.get("erp", {})
394
+ erp_h = int(erp_cfg.get("height", 1024))
395
+ erp_w = int(erp_cfg.get("width", 2048))
396
+
397
+ fusion_cfg = cfg.get("fusion", {})
398
+ blend_mode = str(fusion_cfg.get("blend_mode", "softmin_invdepth"))
399
+
400
+ if blend_mode == "multiband":
401
+ depth_np, weight_np, valid_np = _fuse_multiband(
402
+ tangent_depths, slices, cfg, device, erp_h, erp_w, debug_dir,
403
+ )
404
+ else:
405
+ depth_np, weight_np, valid_np = _fuse_softmin(
406
+ tangent_depths, slices, cfg, device, erp_h, erp_w,
407
+ )
408
+
409
+ # output_scale 校正
410
+ output_scale = float(fusion_cfg.get("output_scale", 1.0))
411
+ if output_scale != 1.0:
412
+ valid = np.isfinite(depth_np) & (depth_np > 0)
413
+ depth_np[valid] *= output_scale
414
+
415
+ return depth_np, weight_np, valid_np
416
+
417
+
418
+ def _fuse_softmin(
419
+ tangent_depths: Dict[str, np.ndarray],
420
+ slices: List[TangentSlice],
421
+ cfg: Dict[str, Any],
422
+ device: torch.device,
423
+ erp_h: int,
424
+ erp_w: int,
425
+ ) -> Tuple[np.ndarray, np.ndarray, np.ndarray]:
426
+ """softmin_invdepth 模式融合"""
427
+ fusion_cfg = cfg.get("fusion", {})
428
+ weight_mode = str(fusion_cfg.get("weight_mode", "cosine"))
429
+ k = float(fusion_cfg.get("k", 4.0))
430
+ depth_competition = str(fusion_cfg.get("depth_competition", "softmin_invdepth"))
431
+ softmin_alpha = float(fusion_cfg.get("softmin_alpha", 10.0))
432
+ min_weight_sum = float(fusion_cfg.get("min_weight_sum", 1e-6))
433
+ pole_boost = bool(fusion_cfg.get("pole_boost", True))
434
+ pole_boost_factor = float(fusion_cfg.get("pole_boost_factor", 1.5))
435
+ pole_latitude_deg = float(fusion_cfg.get("pole_latitude_deg", 75.0))
436
+ pole_ring_cfg = fusion_cfg.get("pole_ring", {})
437
+ pole_ring_enabled = bool(pole_ring_cfg.get("enabled", True))
438
+ pole_ring_min_lat_deg = float(pole_ring_cfg.get("min_latitude_deg", 60.0))
439
+ pole_ring_ramp_deg = float(pole_ring_cfg.get("ramp_deg", 5.0))
440
+ depth_def = str(cfg.get("depth_pro", {}).get("depth_def", "z"))
441
+
442
+ accum_weighted_invdepth = torch.zeros(erp_h * erp_w, device=device, dtype=torch.float32)
443
+ accum_weight = torch.zeros(erp_h * erp_w, device=device, dtype=torch.float32)
444
+
445
+ for s in slices:
446
+ if s.slice_id not in tangent_depths:
447
+ continue
448
+ depth_np = tangent_depths[s.slice_id]
449
+ depth_t = torch.from_numpy(depth_np.astype(np.float32)).to(device)
450
+
451
+ res = s.resolution
452
+ K = s.K
453
+ R_cw = s.R_cw
454
+ fx, fy = float(K[0, 0]), float(K[1, 1])
455
+ cx, cy = float(K[0, 2]), float(K[1, 2])
456
+
457
+ xs = torch.arange(res, device=device, dtype=torch.float32)
458
+ ys = torch.arange(res, device=device, dtype=torch.float32)
459
+ yv, xv = torch.meshgrid(ys, xs, indexing="ij")
460
+
461
+ x_cam = (xv - cx) / fx
462
+ y_cam = -(yv - cy) / fy
463
+ z_cam = torch.ones_like(x_cam)
464
+
465
+ dirs_cam = torch.stack([x_cam, y_cam, z_cam], dim=-1)
466
+ dirs_cam = dirs_cam / torch.clamp(torch.norm(dirs_cam, dim=-1, keepdim=True), min=1e-9)
467
+
468
+ R = torch.tensor(R_cw, device=device, dtype=torch.float32)
469
+ dirs_world = torch.einsum("ij,hwj->hwi", R, dirs_cam)
470
+
471
+ if depth_def == "z":
472
+ ray_length = torch.sqrt(x_cam ** 2 + y_cam ** 2 + 1.0)
473
+ range_depth = depth_t * ray_length
474
+ else:
475
+ range_depth = depth_t
476
+
477
+ u, v = _dirs_to_erp_uv(dirs_world, erp_h, erp_w)
478
+
479
+ if weight_mode == "cosine":
480
+ face_center = torch.tensor(s.center_dir, device=device, dtype=torch.float32)
481
+ base_weight = compute_cosine_weight(dirs_world, face_center, k=k)
482
+ else:
483
+ base_weight = torch.ones_like(range_depth)
484
+
485
+ if s.slice_type == "pole_ring":
486
+ if not pole_ring_enabled:
487
+ base_weight = torch.zeros_like(base_weight)
488
+ else:
489
+ lat = torch.asin(torch.clamp(dirs_world[..., 1], -1.0, 1.0)) * (180.0 / math.pi)
490
+ abs_lat = torch.abs(lat)
491
+ ramp = torch.clamp(
492
+ (abs_lat - pole_ring_min_lat_deg) / max(pole_ring_ramp_deg, 1e-3),
493
+ min=0.0, max=1.0,
494
+ )
495
+ base_weight = base_weight * ramp
496
+
497
+ if pole_boost and s.slice_type in ("pole_north", "pole_south"):
498
+ base_weight = base_weight * pole_boost_factor
499
+
500
+ _forward_splat(
501
+ erp_h, erp_w, u, v, range_depth, base_weight,
502
+ accum_weighted_invdepth, accum_weight,
503
+ depth_competition, softmin_alpha,
504
+ pole_boost, pole_boost_factor, pole_latitude_deg,
505
+ )
506
+
507
+ valid_mask_t = accum_weight > min_weight_sum
508
+
509
+ if depth_competition == "softmin_invdepth":
510
+ avg_invdepth = torch.zeros_like(accum_weighted_invdepth)
511
+ avg_invdepth[valid_mask_t] = accum_weighted_invdepth[valid_mask_t] / accum_weight[valid_mask_t]
512
+ depth_out = torch.zeros_like(avg_invdepth)
513
+ depth_out[valid_mask_t] = 1.0 / torch.clamp(avg_invdepth[valid_mask_t], min=1e-6)
514
+ else:
515
+ depth_out = torch.zeros_like(accum_weighted_invdepth)
516
+ depth_out[valid_mask_t] = accum_weighted_invdepth[valid_mask_t] / accum_weight[valid_mask_t]
517
+
518
+ depth_out[~valid_mask_t] = float("nan")
519
+
520
+ depth_out = depth_out.reshape(erp_h, erp_w)
521
+ weight_sum = accum_weight.reshape(erp_h, erp_w)
522
+ valid_mask = valid_mask_t.reshape(erp_h, erp_w)
523
+
524
+ return (
525
+ depth_out.cpu().numpy().astype(np.float32),
526
+ weight_sum.cpu().numpy().astype(np.float32),
527
+ valid_mask.cpu().numpy().astype(np.uint8),
528
+ )
529
+
530
+
531
+ def _fuse_multiband(
532
+ tangent_depths: Dict[str, np.ndarray],
533
+ slices: List[TangentSlice],
534
+ cfg: Dict[str, Any],
535
+ device: torch.device,
536
+ erp_h: int,
537
+ erp_w: int,
538
+ debug_dir: Optional[Path] = None,
539
+ ) -> Tuple[np.ndarray, np.ndarray, np.ndarray]:
540
+ """Multiband 金字塔融合"""
541
+ fusion_cfg = cfg.get("fusion", {})
542
+ mb_cfg = fusion_cfg.get("multiband", {})
543
+ levels = int(mb_cfg.get("levels", 6))
544
+ highfreq_levels = int(mb_cfg.get("highfreq_levels", 2))
545
+ eps = float(mb_cfg.get("eps", 1e-6))
546
+ min_weight_sum = float(fusion_cfg.get("min_weight_sum", 1e-6))
547
+
548
+ depth_def = str(cfg.get("depth_pro", {}).get("depth_def", "z"))
549
+ k = float(fusion_cfg.get("k", 4.0))
550
+
551
+ # Pole consistency 配置
552
+ pole_cons_cfg = fusion_cfg.get("pole_consistency", {})
553
+ if not isinstance(pole_cons_cfg, dict):
554
+ pole_cons_cfg = {}
555
+ pole_cons_enabled = bool(pole_cons_cfg.get("enabled", False))
556
+ pole_cons_min_lat_deg = float(pole_cons_cfg.get("min_latitude_deg", 60.0))
557
+ pole_cons_min_overlap = int(pole_cons_cfg.get("min_overlap_pixels", 4000))
558
+ pole_cons_max_abs_log_shift = float(pole_cons_cfg.get("max_abs_log_shift", 0.7))
559
+ pole_cons_ref_types = [str(x) for x in pole_cons_cfg.get("ref_slice_types", ["face", "pole_ring"])]
560
+ pole_cons_target_types = [str(x) for x in pole_cons_cfg.get("target_slice_types", ["pole_north", "pole_south"])]
561
+
562
+ top_v_max = int(math.floor((90.0 - pole_cons_min_lat_deg) / 180.0 * float(max(erp_h - 1, 1))))
563
+ bot_v_min = int(math.ceil((90.0 + pole_cons_min_lat_deg) / 180.0 * float(max(erp_h - 1, 1))))
564
+ top_v_max = max(0, min(erp_h - 1, top_v_max))
565
+ bot_v_min = max(0, min(erp_h - 1, bot_v_min))
566
+
567
+ ref_num_top = ref_den_top = ref_num_bot = ref_den_bot = None
568
+ pole_pending: List[TangentSlice] = []
569
+ if pole_cons_enabled:
570
+ ref_num_top = torch.zeros((top_v_max + 1, erp_w), device=device, dtype=torch.float32)
571
+ ref_den_top = torch.zeros_like(ref_num_top)
572
+ ref_num_bot = torch.zeros((erp_h - bot_v_min, erp_w), device=device, dtype=torch.float32)
573
+ ref_den_bot = torch.zeros_like(ref_num_bot)
574
+
575
+ # Per-level accumulators
576
+ kernel = _gauss5_kernel(device=device, dtype=torch.float32)
577
+
578
+ Hs = [erp_h]
579
+ Ws = [erp_w]
580
+ for _ in range(1, levels):
581
+ Hs.append(max(1, Hs[-1] // 2))
582
+ Ws.append(max(1, Ws[-1] // 2))
583
+
584
+ fused_lap: List[torch.Tensor] = []
585
+ best_w: List[torch.Tensor] = []
586
+ sum_w: List[torch.Tensor] = []
587
+ sum_w_lap: List[torch.Tensor] = []
588
+
589
+ for l in range(levels):
590
+ shape = (1, 1, Hs[l], Ws[l])
591
+ if l < highfreq_levels:
592
+ fused_lap.append(torch.zeros(shape, device=device, dtype=torch.float32))
593
+ best_w.append(torch.zeros(shape, device=device, dtype=torch.float32))
594
+ else:
595
+ fused_lap.append(torch.zeros(shape, device=device, dtype=torch.float32))
596
+ sum_w.append(torch.zeros(shape, device=device, dtype=torch.float32))
597
+ sum_w_lap.append(torch.zeros(shape, device=device, dtype=torch.float32))
598
+
599
+ weight_sum0 = torch.zeros(erp_h, erp_w, device=device, dtype=torch.float32)
600
+
601
+ def _process_one_slice(s: TangentSlice, depth_np: np.ndarray):
602
+ depth_t = torch.from_numpy(depth_np.astype(np.float32)).to(device)
603
+
604
+ disp0, w0 = _project_slice_to_erp_disp_weight_zbuffer(
605
+ depth_t, s, cfg, erp_h, erp_w, depth_def, k, device,
606
+ )
607
+ return disp0, w0
608
+
609
+ def _blend_into_pyramid(disp0: torch.Tensor, w0: torch.Tensor):
610
+ nonlocal weight_sum0
611
+ weight_sum0 += w0
612
+
613
+ disp_pyr = [disp0.unsqueeze(0).unsqueeze(0)]
614
+ w_pyr = [w0.unsqueeze(0).unsqueeze(0)]
615
+
616
+ for l in range(1, levels):
617
+ num = _blur_circular_w(disp_pyr[l - 1] * w_pyr[l - 1], kernel)
618
+ den = _blur_circular_w(w_pyr[l - 1], kernel)
619
+ num_ds = _down2(num)
620
+ den_ds = _down2(den)
621
+ disp_ds = num_ds / torch.clamp(den_ds, min=eps)
622
+ disp_pyr.append(disp_ds)
623
+ w_pyr.append(den_ds)
624
+
625
+ lap_pyr: List[torch.Tensor] = []
626
+ for l in range(levels - 1):
627
+ up = _upsample2_circular_w(disp_pyr[l + 1], Hs[l], Ws[l])
628
+ lap_pyr.append(disp_pyr[l] - up)
629
+ lap_pyr.append(disp_pyr[-1])
630
+
631
+ for l in range(levels):
632
+ wl = w_pyr[l]
633
+ Ll = lap_pyr[l]
634
+ if l < highfreq_levels:
635
+ better = wl > best_w[l]
636
+ fused_lap[l] = torch.where(better, Ll, fused_lap[l])
637
+ best_w[l] = torch.where(better, wl, best_w[l])
638
+ else:
639
+ idx = l - highfreq_levels
640
+ sum_w_lap[idx] += wl * Ll
641
+ sum_w[idx] += wl
642
+
643
+ # Process non-pole slices first
644
+ for s in slices:
645
+ if s.slice_id not in tangent_depths:
646
+ continue
647
+ if pole_cons_enabled and (s.slice_type in pole_cons_target_types):
648
+ pole_pending.append(s)
649
+ continue
650
+
651
+ disp0, w0 = _process_one_slice(s, tangent_depths[s.slice_id])
652
+
653
+ # Reference accumulation for pole consistency
654
+ if pole_cons_enabled and (s.slice_type in pole_cons_ref_types):
655
+ if ref_num_top is not None and top_v_max >= 0:
656
+ ref_num_top += disp0[:top_v_max + 1] * w0[:top_v_max + 1]
657
+ ref_den_top += w0[:top_v_max + 1]
658
+ if ref_num_bot is not None and bot_v_min < erp_h:
659
+ ref_num_bot += disp0[bot_v_min:] * w0[bot_v_min:]
660
+ ref_den_bot += w0[bot_v_min:]
661
+
662
+ _blend_into_pyramid(disp0, w0)
663
+
664
+ # Pole consistency pass
665
+ if pole_cons_enabled and pole_pending and ref_num_top is not None:
666
+ ref_disp_top = ref_num_top / torch.clamp(ref_den_top, min=eps)
667
+ ref_disp_bot = ref_num_bot / torch.clamp(ref_den_bot, min=eps)
668
+
669
+ for s in pole_pending:
670
+ disp0, w0 = _process_one_slice(s, tangent_depths[s.slice_id])
671
+
672
+ try:
673
+ if s.slice_type == "pole_north":
674
+ disp_other = disp0[:top_v_max + 1]
675
+ w_other = w0[:top_v_max + 1]
676
+ disp_ref = ref_disp_top
677
+ den_ref = ref_den_top
678
+ else:
679
+ disp_other = disp0[bot_v_min:]
680
+ w_other = w0[bot_v_min:]
681
+ disp_ref = ref_disp_bot
682
+ den_ref = ref_den_bot
683
+
684
+ overlap = (w_other > 1e-9) & (den_ref > 1e-9) & (disp_other > eps) & (disp_ref > eps)
685
+ n_overlap = int(overlap.sum().item())
686
+ if n_overlap >= pole_cons_min_overlap:
687
+ log_ref = -torch.log(disp_ref[overlap].clamp(min=eps))
688
+ log_other = -torch.log(disp_other[overlap].clamp(min=eps))
689
+ shift = float(torch.median(log_ref - log_other).item())
690
+ shift = max(-pole_cons_max_abs_log_shift, min(pole_cons_max_abs_log_shift, shift))
691
+ disp0 = disp0 * float(math.exp(-shift))
692
+ except Exception:
693
+ pass
694
+
695
+ _blend_into_pyramid(disp0, w0)
696
+
697
+ # Finalize lowfreq levels
698
+ for l in range(highfreq_levels, levels):
699
+ idx = l - highfreq_levels
700
+ fused_lap[l] = sum_w_lap[idx] / torch.clamp(sum_w[idx], min=eps)
701
+
702
+ # Reconstruct fused disparity
703
+ disp = fused_lap[-1]
704
+ for l in range(levels - 2, -1, -1):
705
+ disp = _upsample2_circular_w(disp, Hs[l], Ws[l]) + fused_lap[l]
706
+
707
+ disp0_fused = disp.squeeze(0).squeeze(0)
708
+ depth = torch.zeros_like(disp0_fused)
709
+ m = disp0_fused > eps
710
+ depth[m] = 1.0 / disp0_fused[m]
711
+ depth[~m] = float("nan")
712
+
713
+ weight_np = weight_sum0.detach().cpu().numpy().astype(np.float32)
714
+ depth_np = depth.detach().cpu().numpy().astype(np.float32)
715
+ valid_np = (weight_np > min_weight_sum).astype(np.uint8)
716
+
717
+ return depth_np, weight_np, valid_np
718
+
719
+
720
+ # =============================================================================
721
+ # 可视化函数
722
+ # =============================================================================
723
+
724
+ def visualize_depth(
725
+ depth: np.ndarray,
726
+ vmin: Optional[float] = None,
727
+ vmax: Optional[float] = None,
728
+ ) -> np.ndarray:
729
+ """
730
+ 可视化深度图(percentile + TURBO colormap)
731
+
732
+ Returns:
733
+ vis: (H, W, 3) uint8 RGB
734
+ """
735
+ d = depth.astype(np.float32).copy()
736
+ valid = np.isfinite(d) & (d > 0)
737
+
738
+ if not np.any(valid):
739
+ return np.zeros((d.shape[0], d.shape[1], 3), dtype=np.uint8)
740
+
741
+ if vmin is None:
742
+ vmin = float(np.percentile(d[valid], 2))
743
+ if vmax is None:
744
+ vmax = float(np.percentile(d[valid], 98))
745
+ vmax = max(vmax, vmin + 1e-6)
746
+
747
+ d_norm = (np.clip(d, vmin, vmax) - vmin) / (vmax - vmin)
748
+ d_norm[~valid] = 0.0
749
+ d_u8 = (d_norm * 255).astype(np.uint8)
750
+
751
+ try:
752
+ import cv2
753
+ cm = cv2.applyColorMap(d_u8, cv2.COLORMAP_TURBO)
754
+ return cv2.cvtColor(cm, cv2.COLOR_BGR2RGB)
755
+ except ImportError:
756
+ return np.stack([d_u8, d_u8, d_u8], axis=-1)
757
+
758
+
759
+ def save_depth_visualization(
760
+ depth: np.ndarray,
761
+ output_path: Path,
762
+ vmin: Optional[float] = None,
763
+ vmax: Optional[float] = None,
764
+ ) -> None:
765
+ """保存深度可视化图像"""
766
+ import cv2
767
+ vis = visualize_depth(depth, vmin=vmin, vmax=vmax)
768
+ Path(output_path).parent.mkdir(parents=True, exist_ok=True)
769
+ cv2.imwrite(str(output_path), cv2.cvtColor(vis, cv2.COLOR_RGB2BGR))
code/core/erp_projection.py ADDED
@@ -0,0 +1,277 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ ERP 投影模块
3
+
4
+ ERPT_native ERP投影约定:
5
+ - 经度:lon = atan2(x, z),范围 [-π, π]
6
+ - 纬度:lat = asin(y),范围 [-π/2, π/2]
7
+ - 像素坐标:u ∈ [0, W), v ∈ [0, H)
8
+ - 图像中心 (u=W/2, v=H/2) 对应 (lon=0, lat=0),看向 +Z
9
+ - 图像顶部 (v=0) 对应 lat=+π/2,看向 +Y(上)
10
+ - 图像底部 (v=H-1) 对应 lat=-π/2,看向 -Y(下)
11
+ - 图像右边 lon增加,对应 +X 方向
12
+
13
+ 像素到经纬度映射:
14
+ lon = (u / W) * 2π - π
15
+ lat = π/2 - (v / (H-1)) * π
16
+
17
+ 方向向量(相机坐标系,也是世界坐标系当无旋转时):
18
+ x = sin(lon) * cos(lat) # 右
19
+ y = sin(lat) # 上
20
+ z = cos(lon) * cos(lat) # 前
21
+ """
22
+
23
+ import math
24
+ import numpy as np
25
+ import torch
26
+ from typing import Tuple, Union
27
+
28
+
29
+ def erp_to_lonlat(
30
+ u: Union[np.ndarray, torch.Tensor],
31
+ v: Union[np.ndarray, torch.Tensor],
32
+ H: int,
33
+ W: int,
34
+ ) -> Tuple[Union[np.ndarray, torch.Tensor], Union[np.ndarray, torch.Tensor]]:
35
+ """
36
+ ERP像素坐标转经纬度
37
+
38
+ Args:
39
+ u: 水平像素坐标,范围 [0, W)
40
+ v: 垂直像素坐标,范围 [0, H)
41
+ H: 图像高度
42
+ W: 图像宽度
43
+
44
+ Returns:
45
+ lon: 经度,范围 [-π, π]
46
+ lat: 纬度,范围 [-π/2, π/2]
47
+ """
48
+ # lon = (u / W) * 2π - π
49
+ lon = (u / float(W)) * (2.0 * math.pi) - math.pi
50
+
51
+ # lat = π/2 - (v / (H-1)) * π
52
+ lat = (math.pi / 2.0) - (v / float(H - 1)) * math.pi
53
+
54
+ return lon, lat
55
+
56
+
57
+ def lonlat_to_erp(
58
+ lon: Union[np.ndarray, torch.Tensor],
59
+ lat: Union[np.ndarray, torch.Tensor],
60
+ H: int,
61
+ W: int,
62
+ ) -> Tuple[Union[np.ndarray, torch.Tensor], Union[np.ndarray, torch.Tensor]]:
63
+ """
64
+ 经纬度转ERP像素坐标
65
+
66
+ Args:
67
+ lon: 经度,范围 [-π, π]
68
+ lat: 纬度,范围 [-π/2, π/2]
69
+ H: 图像高度
70
+ W: 图像宽度
71
+
72
+ Returns:
73
+ u: 水平像素坐标
74
+ v: 垂直像素坐标
75
+ """
76
+ # u = (lon + π) / (2π) * W
77
+ u = (lon + math.pi) / (2.0 * math.pi) * float(W)
78
+
79
+ # v = (π/2 - lat) / π * (H-1)
80
+ v = (math.pi / 2.0 - lat) / math.pi * float(H - 1)
81
+
82
+ return u, v
83
+
84
+
85
+ def lonlat_to_direction(
86
+ lon: Union[np.ndarray, torch.Tensor],
87
+ lat: Union[np.ndarray, torch.Tensor],
88
+ ) -> Union[np.ndarray, torch.Tensor]:
89
+ """
90
+ 经纬度转方向向量(单位向量)
91
+
92
+ 坐标系:[X右, Y上, Z前]
93
+
94
+ Args:
95
+ lon: 经度
96
+ lat: 纬度
97
+
98
+ Returns:
99
+ dirs: (..., 3) 单位方向向量 [x, y, z]
100
+ """
101
+ if isinstance(lon, torch.Tensor):
102
+ cos_lat = torch.cos(lat)
103
+ x = torch.sin(lon) * cos_lat # 右
104
+ y = torch.sin(lat) # 上
105
+ z = torch.cos(lon) * cos_lat # 前
106
+ dirs = torch.stack([x, y, z], dim=-1)
107
+ else:
108
+ cos_lat = np.cos(lat)
109
+ x = np.sin(lon) * cos_lat
110
+ y = np.sin(lat)
111
+ z = np.cos(lon) * cos_lat
112
+ dirs = np.stack([x, y, z], axis=-1)
113
+
114
+ return dirs
115
+
116
+
117
+ def direction_to_lonlat(
118
+ dirs: Union[np.ndarray, torch.Tensor],
119
+ ) -> Tuple[Union[np.ndarray, torch.Tensor], Union[np.ndarray, torch.Tensor]]:
120
+ """
121
+ 方向向量转经纬度
122
+
123
+ Args:
124
+ dirs: (..., 3) 方向向量 [x, y, z]
125
+
126
+ Returns:
127
+ lon: 经度
128
+ lat: 纬度
129
+ """
130
+ x = dirs[..., 0]
131
+ y = dirs[..., 1]
132
+ z = dirs[..., 2]
133
+
134
+ if isinstance(dirs, torch.Tensor):
135
+ # 归一化
136
+ norm = torch.norm(dirs, dim=-1, keepdim=False)
137
+ norm = torch.clamp(norm, min=1e-9)
138
+
139
+ # lon = atan2(x, z)
140
+ lon = torch.atan2(x, z)
141
+
142
+ # lat = asin(y / norm)
143
+ y_normalized = torch.clamp(y / norm, -1.0, 1.0)
144
+ lat = torch.asin(y_normalized)
145
+ else:
146
+ norm = np.linalg.norm(dirs, axis=-1)
147
+ norm = np.maximum(norm, 1e-9)
148
+
149
+ lon = np.arctan2(x, z)
150
+ y_normalized = np.clip(y / norm, -1.0, 1.0)
151
+ lat = np.arcsin(y_normalized)
152
+
153
+ return lon, lat
154
+
155
+
156
+ def erp_to_direction(
157
+ u: Union[np.ndarray, torch.Tensor],
158
+ v: Union[np.ndarray, torch.Tensor],
159
+ H: int,
160
+ W: int,
161
+ ) -> Union[np.ndarray, torch.Tensor]:
162
+ """
163
+ ERP像素坐标转方向向量
164
+
165
+ Args:
166
+ u: 水平像素坐标
167
+ v: 垂直像素坐标
168
+ H: 图像高度
169
+ W: 图像宽度
170
+
171
+ Returns:
172
+ dirs: (..., 3) 单位方向向量 [x, y, z]
173
+ """
174
+ lon, lat = erp_to_lonlat(u, v, H, W)
175
+ return lonlat_to_direction(lon, lat)
176
+
177
+
178
+ def direction_to_erp(
179
+ dirs: Union[np.ndarray, torch.Tensor],
180
+ H: int,
181
+ W: int,
182
+ ) -> Tuple[Union[np.ndarray, torch.Tensor], Union[np.ndarray, torch.Tensor]]:
183
+ """
184
+ 方向向量转ERP像素坐标
185
+
186
+ Args:
187
+ dirs: (..., 3) 方向向量 [x, y, z]
188
+ H: 图像高度
189
+ W: 图像宽度
190
+
191
+ Returns:
192
+ u: 水平像素坐标
193
+ v: 垂直像素坐标
194
+ """
195
+ lon, lat = direction_to_lonlat(dirs)
196
+ return lonlat_to_erp(lon, lat, H, W)
197
+
198
+
199
+ def create_erp_grid(
200
+ H: int,
201
+ W: int,
202
+ device: torch.device = None,
203
+ ) -> Tuple[torch.Tensor, torch.Tensor]:
204
+ """
205
+ 创建ERP像素网格
206
+
207
+ Args:
208
+ H: 图像高度
209
+ W: 图像宽度
210
+ device: 计算设备
211
+
212
+ Returns:
213
+ uu: (H, W) 水平坐标网格
214
+ vv: (H, W) 垂直坐标网格
215
+ """
216
+ if device is None:
217
+ device = torch.device("cpu")
218
+
219
+ us = torch.arange(W, device=device, dtype=torch.float32)
220
+ vs = torch.arange(H, device=device, dtype=torch.float32)
221
+ vv, uu = torch.meshgrid(vs, us, indexing="ij")
222
+
223
+ return uu, vv
224
+
225
+
226
+ def create_direction_grid(
227
+ H: int,
228
+ W: int,
229
+ device: torch.device = None,
230
+ ) -> torch.Tensor:
231
+ """
232
+ 创建ERP方向向量网格
233
+
234
+ Args:
235
+ H: 图像高度
236
+ W: 图像宽度
237
+ device: 计算设备
238
+
239
+ Returns:
240
+ dirs: (H, W, 3) 单位方向向量
241
+ """
242
+ uu, vv = create_erp_grid(H, W, device)
243
+ return erp_to_direction(uu, vv, H, W)
244
+
245
+
246
+ def wrap_u(u: Union[np.ndarray, torch.Tensor], W: int) -> Union[np.ndarray, torch.Tensor]:
247
+ """
248
+ 水平坐标环绕处理(ERP在水平方向是周期性的)
249
+
250
+ Args:
251
+ u: 水平像素坐标
252
+ W: 图像宽度
253
+
254
+ Returns:
255
+ u_wrapped: 环绕后的坐标,范围 [0, W)
256
+ """
257
+ if isinstance(u, torch.Tensor):
258
+ return torch.remainder(u, float(W))
259
+ else:
260
+ return np.mod(u, float(W))
261
+
262
+
263
+ def clamp_v(v: Union[np.ndarray, torch.Tensor], H: int) -> Union[np.ndarray, torch.Tensor]:
264
+ """
265
+ 垂直坐标裁剪处理
266
+
267
+ Args:
268
+ v: 垂直像素坐标
269
+ H: 图像高度
270
+
271
+ Returns:
272
+ v_clamped: 裁剪后的坐标,范围 [0, H-1]
273
+ """
274
+ if isinstance(v, torch.Tensor):
275
+ return torch.clamp(v, 0.0, float(H - 1))
276
+ else:
277
+ return np.clip(v, 0.0, float(H - 1))
code/core/erp_warp.py ADDED
@@ -0,0 +1,591 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ ERP Forward Warp 模块(移植自原版 ERPT erp_softsplat.py)
3
+
4
+ 使用锁定的投影/坐标系接口:
5
+ - core.erp_projection: erp_to_direction, direction_to_erp, wrap_u, clamp_v
6
+ - utils.pose_utils: Pose (R_cw, R_wc, position)
7
+
8
+ 算法流程:
9
+ 1. 对每个 src ERP 像素,通过 erp_to_direction 获取射线方向
10
+ 2. 根据深度计算 3D 点,变换到目标相机坐标系
11
+ 3. 通过 direction_to_erp 投影到目标 ERP
12
+ 4. Forward splatting 累积 RGB(softmax / zbuffer / point)
13
+
14
+ 支持的 splatting 方法:
15
+ - softmax_splatting(默认):自适应半径 + 高斯核 + softmax 深度竞争
16
+ - zbuffer_splatting:两遍 z-buffer 硬遮挡
17
+ - zbuffer_point:最近邻投影
18
+ """
19
+ from __future__ import annotations
20
+
21
+ import math
22
+ from dataclasses import dataclass
23
+ from typing import Any, Dict, Optional, Tuple
24
+
25
+ import cv2
26
+ import numpy as np
27
+ import torch
28
+
29
+ from .erp_projection import (
30
+ erp_to_direction,
31
+ direction_to_erp,
32
+ wrap_u,
33
+ create_erp_grid,
34
+ )
35
+
36
+ import sys
37
+ from pathlib import Path
38
+ sys.path.insert(0, str(Path(__file__).parent.parent))
39
+ from utils.pose_utils import Pose
40
+
41
+
42
+ @dataclass
43
+ class WarpResult:
44
+ """Warp 结果"""
45
+ warped_rgb: np.ndarray # (H, W, 3) uint8
46
+ valid_mask: np.ndarray # (H, W) uint8, 1=valid, 0=invalid
47
+ flow: Optional[np.ndarray] # (H, W, 2) float32, optical flow
48
+ weight_sum: np.ndarray # (H, W) float32
49
+ warped_depth: Optional[np.ndarray] = None # (H, W) float32, NaN=invalid
50
+
51
+
52
+ # =============================================================================
53
+ # Forward Projection(坐标变换)
54
+ # =============================================================================
55
+
56
+ @torch.no_grad()
57
+ def _forward_project(
58
+ src_depth_t: torch.Tensor,
59
+ src_pose: Pose,
60
+ tgt_pose: Pose,
61
+ erp_h: int,
62
+ erp_w: int,
63
+ device: torch.device,
64
+ uu: Optional[torch.Tensor] = None,
65
+ vv: Optional[torch.Tensor] = None,
66
+ ) -> Tuple[torch.Tensor, torch.Tensor, torch.Tensor, torch.Tensor]:
67
+ """
68
+ 将源 ERP 像素投影到目标 ERP
69
+
70
+ 使用锁定的 erp_projection 接口进行坐标变换。
71
+
72
+ Returns:
73
+ u_tgt, v_tgt: (H, W) 目标像素坐标
74
+ range_tgt: (H, W) 目标 range depth
75
+ dirs_tgt: (H, W, 3) 目标方向向量
76
+ """
77
+ if uu is None or vv is None:
78
+ uu, vv = create_erp_grid(erp_h, erp_w, device)
79
+
80
+ # 1. 源像素 -> 方向(源相机坐标系)
81
+ dirs_src = erp_to_direction(uu, vv, erp_h, erp_w) # (H, W, 3)
82
+
83
+ # 2. 方向 * 深度 -> 源相机坐标系 3D 点
84
+ P_cam_src = dirs_src * src_depth_t.unsqueeze(-1) # (H, W, 3)
85
+
86
+ # 3. 源相机 -> 世界
87
+ R_cw_src = torch.tensor(src_pose.R_cw, device=device, dtype=torch.float32)
88
+ t_src = torch.tensor(src_pose.position, device=device, dtype=torch.float32)
89
+ P_world = torch.einsum("ij,hwj->hwi", R_cw_src, P_cam_src) + t_src
90
+
91
+ # 4. 世界 -> 目标相机
92
+ R_wc_tgt = torch.tensor(tgt_pose.R_wc, device=device, dtype=torch.float32)
93
+ t_tgt = torch.tensor(tgt_pose.position, device=device, dtype=torch.float32)
94
+ P_cam_tgt = torch.einsum("ij,hwj->hwi", R_wc_tgt, P_world - t_tgt)
95
+
96
+ # 5. 目标 range depth 和方向
97
+ range_tgt = torch.norm(P_cam_tgt, dim=-1)
98
+ dirs_tgt = P_cam_tgt / torch.clamp(range_tgt.unsqueeze(-1), min=1e-9)
99
+
100
+ # 6. 方向 -> 目标 ERP 像素
101
+ u_tgt, v_tgt = direction_to_erp(dirs_tgt, erp_h, erp_w)
102
+ u_tgt = wrap_u(u_tgt, erp_w)
103
+
104
+ return u_tgt, v_tgt, range_tgt, dirs_tgt
105
+
106
+
107
+ # =============================================================================
108
+ # Adaptive Softmax Splatting
109
+ # =============================================================================
110
+
111
+ def _adaptive_splat_rgb(
112
+ erp_h: int,
113
+ erp_w: int,
114
+ u: torch.Tensor,
115
+ v: torch.Tensor,
116
+ rgb: torch.Tensor,
117
+ depth_compete: torch.Tensor,
118
+ valid: torch.Tensor,
119
+ alpha: float,
120
+ radius: torch.Tensor,
121
+ occlusion_gate: Optional[Dict[str, Any]] = None,
122
+ ) -> Tuple[torch.Tensor, torch.Tensor, torch.Tensor, torch.Tensor]:
123
+ """
124
+ 自适应半径 softmax splatting
125
+
126
+ - 高斯核加权
127
+ - softmax(alpha * inv_depth) 深度竞争
128
+ - 可选 occlusion gate(近似 z-buffer 门控)
129
+ """
130
+ device = u.device
131
+ u_flat = u.reshape(-1)
132
+ v_flat = v.reshape(-1)
133
+ rgb_flat = rgb.reshape(-1, 3)
134
+ d_flat = depth_compete.reshape(-1)
135
+ valid_flat = valid.reshape(-1)
136
+ r_flat = radius.reshape(-1)
137
+
138
+ # 安全深度
139
+ safe_d = torch.where(
140
+ valid_flat & torch.isfinite(d_flat) & (d_flat > 0),
141
+ d_flat, torch.ones_like(d_flat),
142
+ )
143
+
144
+ # Softmax 权重 = exp(alpha * inv_depth)
145
+ inv_d = 1.0 / torch.clamp(safe_d, min=0.1)
146
+ valid_inv = inv_d[valid_flat]
147
+ inv_max = valid_inv.max() if len(valid_inv) > 0 else inv_d.max()
148
+ exp_w = torch.exp(alpha * (inv_d - inv_max))
149
+
150
+ # 可选 occlusion gate
151
+ gate_enabled = False
152
+ min_d_flat: Optional[torch.Tensor] = None
153
+ gate_abs = 0.0
154
+ gate_rel = 0.0
155
+ if occlusion_gate and bool(occlusion_gate.get("enabled", False)):
156
+ gate_enabled = True
157
+ gate_abs = float(occlusion_gate.get("abs_eps_m", 0.05))
158
+ gate_rel = float(occlusion_gate.get("rel_eps", 0.05))
159
+ u_nn = torch.round(u_flat).to(torch.long)
160
+ v_nn = torch.round(v_flat).to(torch.long)
161
+ u_nn = torch.remainder(u_nn, erp_w)
162
+ v_ok = (v_nn >= 0) & (v_nn < erp_h)
163
+ v_nn_c = torch.clamp(v_nn, 0, erp_h - 1)
164
+ idx_nn = v_nn_c * erp_w + u_nn
165
+ min_d_flat = torch.full((erp_h * erp_w,), float("inf"), device=device)
166
+ d_nn = torch.where(valid_flat & v_ok & torch.isfinite(d_flat),
167
+ d_flat, torch.full_like(d_flat, float("inf")))
168
+ min_d_flat.scatter_reduce_(0, idx_nn, d_nn, reduce="amin", include_self=True)
169
+
170
+ accum_rgb = torch.zeros(erp_h, erp_w, 3, device=device, dtype=torch.float32)
171
+ accum_w = torch.zeros(erp_h, erp_w, device=device, dtype=torch.float32)
172
+ accum_hit = torch.zeros(erp_h, erp_w, device=device, dtype=torch.float32)
173
+ accum_d = torch.zeros(erp_h, erp_w, device=device, dtype=torch.float32)
174
+
175
+ u0 = torch.floor(u_flat).to(torch.int64)
176
+ v0 = torch.floor(v_flat).to(torch.int64)
177
+ du = (u_flat - u0.float()).clamp(0, 1)
178
+ dv = (v_flat - v0.float()).clamp(0, 1)
179
+
180
+ # Splat 范围
181
+ valid_radii = r_flat[valid_flat & torch.isfinite(r_flat)]
182
+ max_r = min(int(valid_radii.max().item()) + 1, 5) if len(valid_radii) > 0 else 2
183
+
184
+ def _add(u_idx, v_idx, bw):
185
+ v_ok = (v_idx >= 0) & (v_idx < erp_h)
186
+ m = valid_flat & v_ok & torch.isfinite(d_flat)
187
+ u_safe = torch.where(m, u_idx, torch.zeros_like(u_idx))
188
+ v_safe = torch.where(m, v_idx, torch.zeros_like(v_idx))
189
+ idx = v_safe * erp_w + u_safe
190
+
191
+ if gate_enabled and min_d_flat is not None:
192
+ md = min_d_flat.gather(0, idx)
193
+ gate = d_flat <= (md * (1.0 + gate_rel) + gate_abs)
194
+ mm = m & gate
195
+ else:
196
+ mm = m
197
+
198
+ final_w = torch.where(mm, bw * exp_w, torch.zeros_like(bw))
199
+ hit_w = torch.where(mm, bw, torch.zeros_like(bw))
200
+ accum_w.view(-1).scatter_add_(0, idx, final_w)
201
+ accum_hit.view(-1).scatter_add_(0, idx, hit_w)
202
+ accum_rgb.view(-1, 3).scatter_add_(
203
+ 0, idx.unsqueeze(-1).expand(-1, 3),
204
+ (final_w.unsqueeze(-1) * rgb_flat).float(),
205
+ )
206
+ accum_d.view(-1).scatter_add_(0, idx, (final_w * d_flat).float())
207
+
208
+ for di in range(-max_r, max_r + 1):
209
+ for dj in range(-max_r, max_r + 1):
210
+ dist_ij = math.sqrt(di * di + dj * dj)
211
+ if dist_ij > max_r + 0.5:
212
+ continue
213
+ dx = float(di) - du
214
+ dy = float(dj) - dv
215
+ dist = torch.sqrt(dx * dx + dy * dy)
216
+ within = dist <= (r_flat + 0.5)
217
+ gauss_w = torch.where(
218
+ within,
219
+ torch.exp(-0.5 * (dist / r_flat.clamp(min=0.5)) ** 2),
220
+ torch.zeros_like(r_flat),
221
+ )
222
+ u_off = torch.remainder(u0 + di, erp_w)
223
+ v_off = v0 + dj
224
+ _add(u_off, v_off, gauss_w)
225
+
226
+ return accum_rgb, accum_w, accum_hit, accum_d
227
+
228
+
229
+ # =============================================================================
230
+ # Z-Buffer Splatting
231
+ # =============================================================================
232
+
233
+ def _zbuffer_splat_rgb(
234
+ erp_h: int, erp_w: int,
235
+ u: torch.Tensor, v: torch.Tensor,
236
+ rgb: torch.Tensor, depth_compete: torch.Tensor, valid: torch.Tensor,
237
+ eps_abs_m: float, eps_rel: float, min_w: float,
238
+ ) -> Tuple[torch.Tensor, torch.Tensor, torch.Tensor, torch.Tensor]:
239
+ """Z-buffer 硬遮挡 forward splatting(两遍法)"""
240
+ device = u.device
241
+ u_flat, v_flat = u.reshape(-1), v.reshape(-1)
242
+ d_flat = depth_compete.reshape(-1)
243
+ rgb_flat = rgb.reshape(-1, 3)
244
+ valid_flat = valid.reshape(-1)
245
+
246
+ m0 = valid_flat & torch.isfinite(u_flat) & torch.isfinite(v_flat) & \
247
+ torch.isfinite(d_flat) & (d_flat > 0.0)
248
+
249
+ u0 = torch.floor(u_flat).to(torch.int64)
250
+ v0 = torch.floor(v_flat).to(torch.int64)
251
+ du = (u_flat - u0.float()).clamp(0, 1)
252
+ dv = (v_flat - v0.float()).clamp(0, 1)
253
+ u0w = torch.remainder(u0, erp_w)
254
+ u1w = torch.remainder(u0 + 1, erp_w)
255
+ v1 = v0 + 1
256
+ w00 = (1 - du) * (1 - dv)
257
+ w10 = du * (1 - dv)
258
+ w01 = (1 - du) * dv
259
+ w11 = du * dv
260
+
261
+ # Pass A: min depth
262
+ min_depth = torch.full((erp_h * erp_w,), float("inf"), device=device)
263
+
264
+ def _amin(ui, vi, w):
265
+ m = m0 & (vi >= 0) & (vi < erp_h) & (w >= min_w)
266
+ us = torch.where(m, ui, torch.zeros_like(ui))
267
+ vs = torch.where(m, vi, torch.zeros_like(vi))
268
+ idx = vs * erp_w + us
269
+ cand = torch.where(m, d_flat, torch.full_like(d_flat, float("inf")))
270
+ min_depth.scatter_reduce_(0, idx, cand, reduce="amin", include_self=True)
271
+
272
+ _amin(u0w, v0, w00); _amin(u1w, v0, w10)
273
+ _amin(u0w, v1, w01); _amin(u1w, v1, w11)
274
+
275
+ # Pass B: accumulate near-front
276
+ accum_rgb = torch.zeros(erp_h, erp_w, 3, device=device)
277
+ accum_w = torch.zeros(erp_h, erp_w, device=device)
278
+ accum_hit = torch.zeros(erp_h, erp_w, device=device)
279
+ accum_d = torch.zeros(erp_h, erp_w, device=device)
280
+
281
+ def _acc(ui, vi, w):
282
+ m = m0 & (vi >= 0) & (vi < erp_h) & (w >= min_w)
283
+ us = torch.where(m, ui, torch.zeros_like(ui))
284
+ vs = torch.where(m, vi, torch.zeros_like(vi))
285
+ idx = vs * erp_w + us
286
+ md = min_depth.gather(0, idx)
287
+ gate = d_flat <= (md * (1 + eps_rel) + eps_abs_m)
288
+ mm = m & gate
289
+ wf = torch.where(mm, w, torch.zeros_like(w))
290
+ accum_w.view(-1).scatter_add_(0, idx, wf)
291
+ accum_hit.view(-1).scatter_add_(0, idx, wf)
292
+ accum_rgb.view(-1, 3).scatter_add_(
293
+ 0, idx.unsqueeze(-1).expand(-1, 3),
294
+ (wf.unsqueeze(-1) * rgb_flat).float(),
295
+ )
296
+ accum_d.view(-1).scatter_add_(0, idx, (wf * d_flat).float())
297
+
298
+ _acc(u0w, v0, w00); _acc(u1w, v0, w10)
299
+ _acc(u0w, v1, w01); _acc(u1w, v1, w11)
300
+
301
+ return accum_rgb, accum_w, accum_hit, accum_d
302
+
303
+
304
+ # =============================================================================
305
+ # Z-Buffer Point
306
+ # =============================================================================
307
+
308
+ def _zbuffer_point_rgb(
309
+ erp_h: int, erp_w: int,
310
+ u: torch.Tensor, v: torch.Tensor,
311
+ rgb: torch.Tensor, depth_compete: torch.Tensor, valid: torch.Tensor,
312
+ eps_abs_m: float, eps_rel: float,
313
+ ) -> Tuple[torch.Tensor, torch.Tensor, torch.Tensor, torch.Tensor]:
314
+ """Z-buffer 点渲染(radius=0, winner-take-all)"""
315
+ device = u.device
316
+ u_flat, v_flat = u.reshape(-1), v.reshape(-1)
317
+ d_flat = depth_compete.reshape(-1)
318
+ rgb_flat = rgb.reshape(-1, 3)
319
+ valid_flat = valid.reshape(-1)
320
+
321
+ m0 = valid_flat & torch.isfinite(u_flat) & torch.isfinite(v_flat) & \
322
+ torch.isfinite(d_flat) & (d_flat > 0.0)
323
+
324
+ u_nn = torch.remainder(torch.round(u_flat).to(torch.int64), erp_w)
325
+ v_nn = torch.round(v_flat).to(torch.int64)
326
+ v_ok = (v_nn >= 0) & (v_nn < erp_h)
327
+ m = m0 & v_ok
328
+ us = torch.where(m, u_nn, torch.zeros_like(u_nn))
329
+ vs = torch.where(m, v_nn, torch.zeros_like(v_nn))
330
+ idx = vs * erp_w + us
331
+
332
+ # Pass A: min depth
333
+ min_depth = torch.full((erp_h * erp_w,), float("inf"), device=device)
334
+ cand = torch.where(m, d_flat, torch.full_like(d_flat, float("inf")))
335
+ min_depth.scatter_reduce_(0, idx, cand, reduce="amin", include_self=True)
336
+
337
+ # Pass B
338
+ md = min_depth.gather(0, idx)
339
+ gate = d_flat <= (md * (1 + eps_rel) + eps_abs_m)
340
+ mm = m & gate
341
+ wf = torch.where(mm, torch.ones_like(d_flat), torch.zeros_like(d_flat))
342
+
343
+ accum_rgb = torch.zeros(erp_h, erp_w, 3, device=device)
344
+ accum_w = torch.zeros(erp_h, erp_w, device=device)
345
+ accum_hit = torch.zeros(erp_h, erp_w, device=device)
346
+ accum_d = torch.zeros(erp_h, erp_w, device=device)
347
+
348
+ accum_w.view(-1).scatter_add_(0, idx, wf)
349
+ accum_hit.view(-1).scatter_add_(0, idx, wf)
350
+ accum_rgb.view(-1, 3).scatter_add_(
351
+ 0, idx.unsqueeze(-1).expand(-1, 3),
352
+ (wf.unsqueeze(-1) * rgb_flat).float(),
353
+ )
354
+ accum_d.view(-1).scatter_add_(0, idx, (wf * d_flat).float())
355
+
356
+ return accum_rgb, accum_w, accum_hit, accum_d
357
+
358
+
359
+ # =============================================================================
360
+ # Hole Fill
361
+ # =============================================================================
362
+
363
+ def _edge_aware_hole_fill(
364
+ rgb: np.ndarray, mask: np.ndarray,
365
+ max_hole_px: int = 5,
366
+ inpaint_radius: int = 2,
367
+ ) -> Tuple[np.ndarray, np.ndarray]:
368
+ """小洞填充(只填充极小洞,避免 disocclusion 被错误填充)"""
369
+ holes = (mask == 0).astype(np.uint8)
370
+ if holes.sum() == 0:
371
+ return rgb, mask
372
+
373
+ num, labels, stats, _ = cv2.connectedComponentsWithStats(holes, connectivity=8)
374
+ fill_mask = np.zeros_like(holes)
375
+ max_area = max_hole_px * max_hole_px
376
+
377
+ for i in range(1, num):
378
+ area = stats[i, cv2.CC_STAT_AREA]
379
+ if area <= max_area:
380
+ fill_mask[labels == i] = 1
381
+
382
+ if fill_mask.sum() == 0:
383
+ return rgb, mask
384
+
385
+ rgb_bgr = cv2.cvtColor(rgb, cv2.COLOR_RGB2BGR)
386
+ filled = cv2.inpaint(rgb_bgr, fill_mask, inpaint_radius, cv2.INPAINT_TELEA)
387
+ filled_rgb = cv2.cvtColor(filled, cv2.COLOR_BGR2RGB)
388
+
389
+ rgb_out = rgb.copy()
390
+ mask_out = mask.copy()
391
+ fill_bool = fill_mask > 0
392
+ rgb_out[fill_bool] = filled_rgb[fill_bool]
393
+ mask_out[fill_bool] = 1
394
+
395
+ return rgb_out, mask_out
396
+
397
+
398
+ # =============================================================================
399
+ # 主函数
400
+ # =============================================================================
401
+
402
+ @torch.no_grad()
403
+ def warp_erp_to_target(
404
+ src_rgb: np.ndarray,
405
+ src_depth: np.ndarray,
406
+ src_pose: Pose,
407
+ tgt_pose: Pose,
408
+ cfg: Dict[str, Any],
409
+ device: torch.device,
410
+ ) -> WarpResult:
411
+ """
412
+ 从源 ERP 视角 warp 到目标 ERP 视角
413
+
414
+ 使用锁定的 erp_projection.py 进行坐标变换,
415
+ ���用锁定的 pose_utils.Pose 进行位姿处理。
416
+
417
+ Args:
418
+ src_rgb: (H, W, 3) uint8 源 RGB
419
+ src_depth: (H, W) float32 源 range depth(米)
420
+ src_pose: 源相机位姿(Pose 实例)
421
+ tgt_pose: 目标相机位姿(Pose 实例)
422
+ cfg: 配置字典
423
+ device: 计算设备
424
+
425
+ Returns:
426
+ WarpResult
427
+ """
428
+ warp_cfg = cfg.get("warp", {})
429
+ method = str(warp_cfg.get("method", "softmax_splatting"))
430
+ alpha = float(warp_cfg.get("alpha", 2.0))
431
+ min_weight_sum = float(warp_cfg.get("min_weight_sum", 1e-4))
432
+ output_flow = bool(warp_cfg.get("output_flow", True))
433
+ output_depth = bool(warp_cfg.get("output_depth", True))
434
+ depth_scale_factor = float(warp_cfg.get("depth_scale_factor", 1.0))
435
+
436
+ # Z-buffer 参数
437
+ z_eps_abs = float(warp_cfg.get("zbuffer_eps_abs_m", 0.03))
438
+ z_eps_rel = float(warp_cfg.get("zbuffer_eps_rel", 0.03))
439
+ z_min_w = float(warp_cfg.get("zbuffer_min_weight", 1e-3))
440
+
441
+ # 自适应半径参数
442
+ base_radius = float(warp_cfg.get("splat_radius_px", 1.5))
443
+ radius_min = float(warp_cfg.get("radius_min_px", 0.6))
444
+ radius_max_eq = float(warp_cfg.get("radius_max_px", 2.2))
445
+ radius_max_pole = float(warp_cfg.get("radius_max_pole_px", 3.4))
446
+ pole_radius_scale = float(warp_cfg.get("pole_radius_scale", 3.0))
447
+ pole_lat_threshold = float(warp_cfg.get("pole_lat_threshold", 60.0)) * math.pi / 180.0
448
+ depth_radius_scale = bool(warp_cfg.get("depth_radius_scale", False))
449
+ depth_ref = float(warp_cfg.get("depth_ref_m", 2.0))
450
+ depth_edge_aware = bool(warp_cfg.get("depth_edge_aware", True))
451
+ depth_edge_threshold = float(warp_cfg.get("depth_edge_threshold", 0.3))
452
+ depth_edge_min_scale = float(warp_cfg.get("depth_edge_min_scale", 0.12))
453
+
454
+ # Hole fill
455
+ hole_fill = bool(warp_cfg.get("hole_fill_enabled", False)) and method not in ("zbuffer_splatting", "zbuffer_point")
456
+ max_hole_px = int(warp_cfg.get("max_hole_px", 16))
457
+
458
+ erp_h, erp_w = src_rgb.shape[:2]
459
+
460
+ # 转 tensor
461
+ src_rgb_t = torch.from_numpy(src_rgb.astype(np.float32)).to(device) / 255.0
462
+ src_depth_t = torch.from_numpy(src_depth.astype(np.float32)).to(device)
463
+ if depth_scale_factor != 1.0:
464
+ src_depth_t *= depth_scale_factor
465
+
466
+ valid = torch.isfinite(src_depth_t) & (src_depth_t > 0.0)
467
+
468
+ # --- 深度边缘掩码 ---
469
+ depth_edge_scale = torch.ones_like(src_depth_t)
470
+ if depth_edge_aware:
471
+ from torch.nn.functional import conv2d
472
+ sobel_x = torch.tensor([[-1, 0, 1], [-2, 0, 2], [-1, 0, 1]],
473
+ dtype=torch.float32, device=device).view(1, 1, 3, 3)
474
+ sobel_y = torch.tensor([[-1, -2, -1], [0, 0, 0], [1, 2, 1]],
475
+ dtype=torch.float32, device=device).view(1, 1, 3, 3)
476
+ safe_d = torch.where(valid, src_depth_t, src_depth_t[valid].median() if valid.any() else torch.ones_like(src_depth_t))
477
+ log_d = torch.log(torch.clamp(safe_d, min=0.1)).unsqueeze(0).unsqueeze(0)
478
+ gx = conv2d(log_d, sobel_x, padding=1).squeeze()
479
+ gy = conv2d(log_d, sobel_y, padding=1).squeeze()
480
+ grad = torch.sqrt(gx ** 2 + gy ** 2)
481
+ gmax = grad.max()
482
+ if gmax > 1e-6:
483
+ gnorm = grad / gmax
484
+ else:
485
+ gnorm = torch.zeros_like(grad)
486
+ depth_edge_scale = torch.clamp(
487
+ 1.0 - gnorm / max(depth_edge_threshold, 1e-6),
488
+ min=depth_edge_min_scale, max=1.0,
489
+ )
490
+ depth_edge_scale = torch.where(torch.isfinite(depth_edge_scale),
491
+ depth_edge_scale, torch.ones_like(depth_edge_scale))
492
+
493
+ # --- ERP 网格 ---
494
+ uu, vv = create_erp_grid(erp_h, erp_w, device)
495
+
496
+ # --- Forward project ---
497
+ u_tgt, v_tgt, range_tgt, dirs_tgt = _forward_project(
498
+ src_depth_t, src_pose, tgt_pose, erp_h, erp_w, device, uu, vv,
499
+ )
500
+
501
+ # --- 自适应半径 ---
502
+ lat_tgt = torch.asin(torch.clamp(dirs_tgt[..., 1], -1.0, 1.0))
503
+ abs_lat = torch.abs(lat_tgt)
504
+ pole_factor = torch.clamp(
505
+ (abs_lat - pole_lat_threshold) / (0.5 * math.pi - pole_lat_threshold),
506
+ min=0.0, max=1.0,
507
+ )
508
+ lat_scale = 1.0 + pole_factor * (pole_radius_scale - 1.0)
509
+
510
+ if depth_radius_scale:
511
+ safe_range = torch.where(valid, range_tgt, torch.full_like(range_tgt, depth_ref))
512
+ d_scale = 1.0 / (1.0 + safe_range / depth_ref)
513
+ else:
514
+ d_scale = torch.ones_like(range_tgt)
515
+
516
+ adaptive_radius = base_radius * lat_scale * d_scale * depth_edge_scale
517
+ adaptive_radius = torch.where(valid, adaptive_radius, torch.full_like(adaptive_radius, base_radius))
518
+ radius_max_local = radius_max_eq + pole_factor * (radius_max_pole - radius_max_eq)
519
+ adaptive_radius = torch.clamp(adaptive_radius, min=radius_min)
520
+ adaptive_radius = torch.minimum(adaptive_radius, radius_max_local)
521
+
522
+ # --- Splatting ---
523
+ if method == "zbuffer_splatting":
524
+ _rgb, _w, _hit, _d = _zbuffer_splat_rgb(
525
+ erp_h, erp_w, u_tgt, v_tgt, src_rgb_t, range_tgt, valid,
526
+ z_eps_abs, z_eps_rel, z_min_w,
527
+ )
528
+ elif method == "zbuffer_point":
529
+ _rgb, _w, _hit, _d = _zbuffer_point_rgb(
530
+ erp_h, erp_w, u_tgt, v_tgt, src_rgb_t, range_tgt, valid,
531
+ z_eps_abs, z_eps_rel,
532
+ )
533
+ else:
534
+ _rgb, _w, _hit, _d = _adaptive_splat_rgb(
535
+ erp_h, erp_w, u_tgt, v_tgt, src_rgb_t, range_tgt, valid,
536
+ alpha, adaptive_radius, warp_cfg.get("occlusion_gate", None),
537
+ )
538
+
539
+ # --- 归一化 ---
540
+ denom = _w > 0.0
541
+ out_rgb = torch.zeros_like(_rgb)
542
+ out_rgb[denom] = _rgb[denom] / _w[denom].unsqueeze(-1)
543
+
544
+ min_hit = float(warp_cfg.get("min_hit_sum", 1e-6))
545
+ valid_mask = _hit > min_hit
546
+
547
+ warped_np = (out_rgb.clamp(0, 1) * 255).byte().cpu().numpy()
548
+ mask_np = valid_mask.cpu().numpy().astype(np.uint8)
549
+ weight_np = _hit.cpu().numpy().astype(np.float32)
550
+
551
+ # --- Warped depth ---
552
+ warped_depth_np = None
553
+ if output_depth:
554
+ out_d = torch.full((erp_h, erp_w), float("nan"), device=device)
555
+ out_d[denom] = _d[denom] / torch.clamp(_w[denom], min=1e-9)
556
+ out_d[~valid_mask] = float("nan")
557
+ warped_depth_np = out_d.cpu().numpy().astype(np.float32)
558
+
559
+ # --- Hole fill ---
560
+ if hole_fill:
561
+ warped_np, mask_np = _edge_aware_hole_fill(warped_np, mask_np, max_hole_px)
562
+
563
+ # --- Optical flow ---
564
+ flow_np = None
565
+ if output_flow:
566
+ du = u_tgt - uu
567
+ du = (du + 0.5 * erp_w) % erp_w - 0.5 * erp_w
568
+ dv = v_tgt - vv
569
+ flow_np = torch.stack([du, dv], dim=-1).cpu().numpy().astype(np.float32)
570
+
571
+ return WarpResult(
572
+ warped_rgb=warped_np,
573
+ valid_mask=mask_np,
574
+ flow=flow_np,
575
+ weight_sum=weight_np,
576
+ warped_depth=warped_depth_np,
577
+ )
578
+
579
+
580
+ def create_comparison_image(
581
+ warped_rgb: np.ndarray,
582
+ valid_mask: np.ndarray,
583
+ gt_rgb: Optional[np.ndarray] = None,
584
+ ) -> np.ndarray:
585
+ """创建对比图(warped | GT),如无 GT 则只返回 warped"""
586
+ vis = warped_rgb.copy()
587
+ vis[valid_mask == 0] = 0
588
+
589
+ if gt_rgb is not None:
590
+ return np.concatenate([vis, gt_rgb], axis=0)
591
+ return vis
code/core/tangent_extraction.py ADDED
@@ -0,0 +1,566 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ ERP -> Tangent 切片生成模块(移植自原版 ERPT)
3
+
4
+ 功能:
5
+ 1. 生成 icosahedron 20 面的相机朝向
6
+ 2. 生成 north/south pole 额外切片(使用更大 FOV)
7
+ 3. 从 ERP 采样生成透视切片(支持 seam wrap)
8
+ 4. 输出切片 RGB 和元数据
9
+
10
+ 关键算法:
11
+ - icosahedron 面法向计算
12
+ - 相机坐标系构建(look-at)
13
+ - ERP -> 透视投影(grid_sample with seam wrap)
14
+ """
15
+ from __future__ import annotations
16
+
17
+ import math
18
+ from dataclasses import dataclass
19
+ from pathlib import Path
20
+ from typing import Any, Dict, List, Optional, Tuple
21
+
22
+ import numpy as np
23
+ import torch
24
+ import torch.nn.functional as F
25
+
26
+
27
+ @dataclass
28
+ class TangentSlice:
29
+ """切片规格"""
30
+ slice_id: str # 切片 ID(如 "face_00", "north", "south")
31
+ slice_type: str # 类型:"face" | "pole_north" | "pole_south"
32
+ center_dir: np.ndarray # 切片中心方向(世界坐标,单位向量)
33
+ R_cw: np.ndarray # 相机到世界的旋转矩阵 (3,3)
34
+ fov_deg: float # 视场角(度)
35
+ resolution: int # 输出分辨率(像素,正方形)
36
+ K: np.ndarray # 相机内参 (3,3)
37
+ f_px: float # 焦距(像素)
38
+
39
+ def to_dict(self) -> Dict[str, Any]:
40
+ """转换为可 JSON 序列化的字典"""
41
+ return {
42
+ "slice_id": self.slice_id,
43
+ "slice_type": self.slice_type,
44
+ "center_dir": self.center_dir.tolist(),
45
+ "R_cw": self.R_cw.tolist(),
46
+ "fov_deg": float(self.fov_deg),
47
+ "resolution": int(self.resolution),
48
+ "K": self.K.tolist(),
49
+ "f_px": float(self.f_px),
50
+ }
51
+
52
+
53
+ def _compute_icosahedron_face_centers() -> List[np.ndarray]:
54
+ """
55
+ 计算正二十面体 20 个面的中心方向(单位向量)
56
+
57
+ 正二十面体有 12 个顶点、20 个面、30 条边。
58
+ 每个面是等边三角形,面中心 = (v0 + v1 + v2) / 3 归一化
59
+
60
+ Returns:
61
+ 20 个单位向量的列表,每个指向一个面的中心
62
+ """
63
+ # 黄金比例
64
+ phi = (1.0 + math.sqrt(5.0)) / 2.0
65
+
66
+ # 正二十面体 12 个顶点(坐标已归一化)
67
+ vertices = np.array([
68
+ [-1, phi, 0],
69
+ [ 1, phi, 0],
70
+ [-1, -phi, 0],
71
+ [ 1, -phi, 0],
72
+ [0, -1, phi],
73
+ [0, 1, phi],
74
+ [0, -1, -phi],
75
+ [0, 1, -phi],
76
+ [ phi, 0, -1],
77
+ [ phi, 0, 1],
78
+ [-phi, 0, -1],
79
+ [-phi, 0, 1],
80
+ ], dtype=np.float64)
81
+
82
+ # 归一化顶点
83
+ vertices = vertices / np.linalg.norm(vertices, axis=1, keepdims=True)
84
+
85
+ # 20 个面的顶点索引
86
+ faces = [
87
+ (0, 11, 5), (0, 5, 1), (0, 1, 7), (0, 7, 10), (0, 10, 11),
88
+ (1, 5, 9), (5, 11, 4), (11, 10, 2), (10, 7, 6), (7, 1, 8),
89
+ (3, 9, 4), (3, 4, 2), (3, 2, 6), (3, 6, 8), (3, 8, 9),
90
+ (4, 9, 5), (2, 4, 11), (6, 2, 10), (8, 6, 7), (9, 8, 1),
91
+ ]
92
+
93
+ centers = []
94
+ for i0, i1, i2 in faces:
95
+ center = vertices[i0] + vertices[i1] + vertices[i2]
96
+ center = center / np.linalg.norm(center)
97
+ centers.append(center.astype(np.float32))
98
+
99
+ return centers
100
+
101
+
102
+ def _look_at_rotation(forward: np.ndarray, up_hint: Optional[np.ndarray] = None) -> np.ndarray:
103
+ """
104
+ 构建从相机坐标系到世界坐标系的旋转矩阵
105
+
106
+ 相机坐标系约定:
107
+ - +Z: 前向(forward)
108
+ - +Y: 上方(up)
109
+ - +X: 右方(right = up × forward)
110
+
111
+ Args:
112
+ forward: 相机前向方向(世界坐标,单位向量)
113
+ up_hint: 上方提示(默认世界 Y 轴)
114
+
115
+ Returns:
116
+ R_cw: (3,3) 旋转矩阵,v_world = R_cw @ v_cam
117
+ """
118
+ f = np.asarray(forward, dtype=np.float64).reshape(3)
119
+ f = f / (np.linalg.norm(f) + 1e-12)
120
+
121
+ if up_hint is None:
122
+ up_hint = np.array([0.0, 1.0, 0.0], dtype=np.float64)
123
+ u = np.asarray(up_hint, dtype=np.float64).reshape(3)
124
+ u = u / (np.linalg.norm(u) + 1e-12)
125
+
126
+ # 如果 forward 与 up_hint 几乎平行,换一个 up_hint
127
+ if abs(np.dot(f, u)) > 0.95:
128
+ u = np.array([0.0, 0.0, 1.0], dtype=np.float64)
129
+
130
+ # 右方向 = up × forward
131
+ r = np.cross(u, f)
132
+ r = r / (np.linalg.norm(r) + 1e-12)
133
+
134
+ # 真正的上方向 = forward × right
135
+ u2 = np.cross(f, r)
136
+ u2 = u2 / (np.linalg.norm(u2) + 1e-12)
137
+
138
+ # 旋转矩阵的列是相机坐标轴在世界坐标系中的表示
139
+ R_cw = np.stack([r, u2, f], axis=1)
140
+ return R_cw.astype(np.float32)
141
+
142
+
143
+ def _compute_intrinsics(resolution: int, fov_deg: float) -> Tuple[np.ndarray, float]:
144
+ """
145
+ 计算针孔相机内参
146
+
147
+ Args:
148
+ resolution: 图像分辨率(正方形)
149
+ fov_deg: 水平视场角(度)
150
+
151
+ Returns:
152
+ K: (3,3) 内参矩阵
153
+ f_px: 焦距(像素)
154
+ """
155
+ fov_rad = np.deg2rad(fov_deg)
156
+ f_px = 0.5 * resolution / np.tan(0.5 * fov_rad)
157
+
158
+ cx = (resolution - 1) * 0.5
159
+ cy = (resolution - 1) * 0.5
160
+
161
+ K = np.array([
162
+ [f_px, 0.0, cx],
163
+ [0.0, f_px, cy],
164
+ [0.0, 0.0, 1.0]
165
+ ], dtype=np.float32)
166
+
167
+ return K, float(f_px)
168
+
169
+
170
+ def build_icosahedron_slices(cfg: Dict[str, Any]) -> List[TangentSlice]:
171
+ """
172
+ 根据配置构建 icosahedron + poles 切片列表
173
+
174
+ 360MonoDepth 风格:使用 padding_factor 而非 overlap_pad_deg
175
+ 有效 FOV = base_fov * padding_factor
176
+
177
+ Args:
178
+ cfg: 配置字典(包含 tangent 配置)
179
+
180
+ Returns:
181
+ 切片规格列表
182
+ """
183
+ tcfg = cfg.get("tangent", {})
184
+
185
+ # 基本参数
186
+ face_resolution = int(tcfg.get("face_resolution", 768))
187
+ fov_deg = float(tcfg.get("fov_deg", 90.0))
188
+
189
+ # 360MonoDepth 风格 padding(优先使用 padding_factor)
190
+ padding_factor = float(tcfg.get("padding_factor", 1.3))
191
+ overlap_pad_deg = float(tcfg.get("overlap_pad_deg", 0.0)) # 向后兼容
192
+
193
+ # 计算有效 FOV
194
+ if padding_factor > 1.0:
195
+ effective_fov = fov_deg * padding_factor
196
+ else:
197
+ effective_fov = fov_deg + overlap_pad_deg
198
+
199
+ # 限制最大 FOV 避免极端畸变
200
+ effective_fov = min(effective_fov, 170.0)
201
+
202
+ # 极区参数(增强覆盖)
203
+ add_poles = bool(tcfg.get("add_poles", True))
204
+ pole_fov_deg = float(tcfg.get("pole_fov_deg", 150.0)) # 默认更大
205
+ pole_resolution = int(tcfg.get("pole_resolution", face_resolution))
206
+ pole_extra_rings = int(tcfg.get("pole_extra_rings", 0)) # 额外极区密采样
207
+
208
+ slices = []
209
+
210
+ # 1. 添加 20 个 icosahedron 面
211
+ face_centers = _compute_icosahedron_face_centers()
212
+ for i, center in enumerate(face_centers):
213
+ R_cw = _look_at_rotation(center)
214
+ K, f_px = _compute_intrinsics(face_resolution, effective_fov)
215
+
216
+ slices.append(TangentSlice(
217
+ slice_id=f"face_{i:02d}",
218
+ slice_type="face",
219
+ center_dir=center,
220
+ R_cw=R_cw,
221
+ fov_deg=effective_fov,
222
+ resolution=face_resolution,
223
+ K=K,
224
+ f_px=f_px,
225
+ ))
226
+
227
+ # 2. 添加极区切片
228
+ if add_poles:
229
+ # 北极(+Y)
230
+ north_dir = np.array([0.0, 1.0, 0.0], dtype=np.float32)
231
+ R_north = _look_at_rotation(north_dir, up_hint=np.array([0.0, 0.0, -1.0]))
232
+ K_north, f_north = _compute_intrinsics(pole_resolution, pole_fov_deg)
233
+
234
+ slices.append(TangentSlice(
235
+ slice_id="north",
236
+ slice_type="pole_north",
237
+ center_dir=north_dir,
238
+ R_cw=R_north,
239
+ fov_deg=pole_fov_deg,
240
+ resolution=pole_resolution,
241
+ K=K_north,
242
+ f_px=f_north,
243
+ ))
244
+
245
+ # 南极(-Y)
246
+ south_dir = np.array([0.0, -1.0, 0.0], dtype=np.float32)
247
+ R_south = _look_at_rotation(south_dir, up_hint=np.array([0.0, 0.0, 1.0]))
248
+ K_south, f_south = _compute_intrinsics(pole_resolution, pole_fov_deg)
249
+
250
+ slices.append(TangentSlice(
251
+ slice_id="south",
252
+ slice_type="pole_south",
253
+ center_dir=south_dir,
254
+ R_cw=R_south,
255
+ fov_deg=pole_fov_deg,
256
+ resolution=pole_resolution,
257
+ K=K_south,
258
+ f_px=f_south,
259
+ ))
260
+
261
+ # 3. 额外极区密采样环(可选)
262
+ if pole_extra_rings > 0:
263
+ _add_polar_ring_slices(
264
+ slices, pole_extra_rings, pole_resolution, pole_fov_deg * 0.8
265
+ )
266
+
267
+ return slices
268
+
269
+
270
+ def _add_polar_ring_slices(
271
+ slices: List[TangentSlice],
272
+ num_rings: int,
273
+ resolution: int,
274
+ fov_deg: float,
275
+ ) -> None:
276
+ """
277
+ 添加额外的极区密采样切片(环状分布在极区附近)
278
+ """
279
+ latitudes = [math.radians(75)]
280
+ if num_rings > 1:
281
+ latitudes = [math.radians(60 + 25 * i / (num_rings - 1)) for i in range(num_rings)]
282
+
283
+ K, f_px = _compute_intrinsics(resolution, fov_deg)
284
+
285
+ for ring_idx, lat in enumerate(latitudes):
286
+ num_slices_per_ring = 6
287
+ for lon_idx in range(num_slices_per_ring):
288
+ lon = lon_idx * 2 * math.pi / num_slices_per_ring
289
+
290
+ # 北极附近
291
+ x_n = math.cos(lat) * math.sin(lon)
292
+ y_n = math.sin(lat)
293
+ z_n = math.cos(lat) * math.cos(lon)
294
+ dir_n = np.array([x_n, y_n, z_n], dtype=np.float32)
295
+ R_n = _look_at_rotation(dir_n)
296
+
297
+ slices.append(TangentSlice(
298
+ slice_id=f"pole_ring_n_{ring_idx}_{lon_idx}",
299
+ slice_type="pole_ring",
300
+ center_dir=dir_n,
301
+ R_cw=R_n,
302
+ fov_deg=fov_deg,
303
+ resolution=resolution,
304
+ K=K,
305
+ f_px=f_px,
306
+ ))
307
+
308
+ # 南极附近
309
+ y_s = -math.sin(lat)
310
+ dir_s = np.array([x_n, y_s, z_n], dtype=np.float32)
311
+ R_s = _look_at_rotation(dir_s)
312
+
313
+ slices.append(TangentSlice(
314
+ slice_id=f"pole_ring_s_{ring_idx}_{lon_idx}",
315
+ slice_type="pole_ring",
316
+ center_dir=dir_s,
317
+ R_cw=R_s,
318
+ fov_deg=fov_deg,
319
+ resolution=resolution,
320
+ K=K,
321
+ f_px=f_px,
322
+ ))
323
+
324
+
325
+ def _build_sample_grid(
326
+ slice_spec: TangentSlice,
327
+ erp_h: int,
328
+ erp_w: int,
329
+ device: torch.device,
330
+ ) -> torch.Tensor:
331
+ """
332
+ 构建从 ERP 采样到切片的网格
333
+
334
+ 对于切片的每个像素 (u, v):
335
+ 1. 反投影到相机坐标系射线方向
336
+ 2. 旋转到世界坐标系
337
+ 3. 计算球面经纬度
338
+ 4. 映射到 ERP 像素坐标
339
+ """
340
+ res = slice_spec.resolution
341
+ K = slice_spec.K
342
+ R_cw = slice_spec.R_cw
343
+
344
+ fx, fy = float(K[0, 0]), float(K[1, 1])
345
+ cx, cy = float(K[0, 2]), float(K[1, 2])
346
+
347
+ # 切片像素坐标
348
+ xs = torch.arange(res, device=device, dtype=torch.float32)
349
+ ys = torch.arange(res, device=device, dtype=torch.float32)
350
+ yv, xv = torch.meshgrid(ys, xs, indexing="ij") # (H, W)
351
+
352
+ # 反投影到相机坐标系
353
+ x_cam = (xv - cx) / fx
354
+ y_cam = -(yv - cy) / fy # 图像 y 向下,相机 y 向上
355
+ z_cam = torch.ones_like(x_cam)
356
+
357
+ # 归一化射线方向
358
+ dirs_cam = torch.stack([x_cam, y_cam, z_cam], dim=-1) # (H, W, 3)
359
+ dirs_cam = dirs_cam / torch.clamp(torch.norm(dirs_cam, dim=-1, keepdim=True), min=1e-9)
360
+
361
+ # 旋转到世界坐标系
362
+ R = torch.tensor(R_cw, device=device, dtype=torch.float32)
363
+ dirs_world = torch.einsum("ij,hwj->hwi", R, dirs_cam) # (H, W, 3)
364
+
365
+ # 计算球面坐标
366
+ x = dirs_world[..., 0]
367
+ y = dirs_world[..., 1]
368
+ z = dirs_world[..., 2]
369
+
370
+ lon = torch.atan2(x, z)
371
+ lat = torch.asin(torch.clamp(y, -1.0, 1.0))
372
+
373
+ # 映射到 ERP 像素坐标
374
+ u = (lon + math.pi) / (2.0 * math.pi) * float(erp_w)
375
+ v = (math.pi / 2.0 - lat) / math.pi * float(erp_h - 1)
376
+
377
+ # Seam wrap: ERP 在 x 方向扩展 3 倍,采样时从中间段采样
378
+ u_padded = u + float(erp_w)
379
+ erp_w_padded = erp_w * 3
380
+
381
+ x_norm = (u_padded / float(erp_w_padded - 1)) * 2.0 - 1.0
382
+ y_norm = (v / float(erp_h - 1)) * 2.0 - 1.0
383
+
384
+ grid = torch.stack([x_norm, y_norm], dim=-1).unsqueeze(0) # (1, H, W, 2)
385
+ return grid
386
+
387
+
388
+ @torch.no_grad()
389
+ def extract_tangent_from_erp(
390
+ erp_rgb: torch.Tensor,
391
+ slice_spec: TangentSlice,
392
+ device: torch.device,
393
+ ) -> np.ndarray:
394
+ """
395
+ 从 ERP 提取单个切片
396
+
397
+ Args:
398
+ erp_rgb: (1, 3, H, W) ERP 图像
399
+ slice_spec: 切片规格
400
+ device: 计算设备
401
+
402
+ Returns:
403
+ tangent_rgb: (H, W, 3) uint8 numpy array
404
+ """
405
+ erp_h, erp_w = erp_rgb.shape[2], erp_rgb.shape[3]
406
+
407
+ # Seam wrap: 扩展 ERP 宽度
408
+ erp_padded = torch.cat([erp_rgb, erp_rgb, erp_rgb], dim=-1) # (1, 3, H, 3W)
409
+
410
+ # 构建采样网格
411
+ grid = _build_sample_grid(slice_spec, erp_h, erp_w, device)
412
+
413
+ # 采样
414
+ tangent = F.grid_sample(
415
+ erp_padded,
416
+ grid,
417
+ mode="bilinear",
418
+ padding_mode="border",
419
+ align_corners=True,
420
+ ) # (1, 3, res, res)
421
+
422
+ # 转换为 numpy
423
+ tangent_np = (tangent.squeeze(0).permute(1, 2, 0).clamp(0, 1) * 255.0).byte().cpu().numpy()
424
+ return tangent_np
425
+
426
+
427
+ @torch.no_grad()
428
+ def extract_all_tangents(
429
+ erp_rgb_np: np.ndarray,
430
+ slices: List[TangentSlice],
431
+ device: torch.device,
432
+ ) -> Dict[str, np.ndarray]:
433
+ """
434
+ 从 ERP 提取所有切片
435
+
436
+ Args:
437
+ erp_rgb_np: (H, W, 3) ERP 图像 numpy array
438
+ slices: 切片规格列表
439
+ device: 计算设备
440
+
441
+ Returns:
442
+ 字典 {slice_id: tangent_rgb}
443
+ """
444
+ erp_t = torch.from_numpy(erp_rgb_np).to(device).permute(2, 0, 1).float() / 255.0
445
+ erp_t = erp_t.unsqueeze(0) # (1, 3, H, W)
446
+
447
+ results = {}
448
+ for s in slices:
449
+ tangent = extract_tangent_from_erp(erp_t, s, device)
450
+ results[s.slice_id] = tangent
451
+
452
+ return results
453
+
454
+
455
+ def compute_ray_directions_for_slice(
456
+ slice_spec: TangentSlice,
457
+ device: torch.device,
458
+ ) -> torch.Tensor:
459
+ """
460
+ 计算切片每个像素对应的世界坐标系射线方向(融合时使用)
461
+
462
+ Returns:
463
+ dirs_world: (H, W, 3) 单位方向向量
464
+ """
465
+ res = slice_spec.resolution
466
+ K = slice_spec.K
467
+ R_cw = slice_spec.R_cw
468
+
469
+ fx, fy = float(K[0, 0]), float(K[1, 1])
470
+ cx, cy = float(K[0, 2]), float(K[1, 2])
471
+
472
+ xs = torch.arange(res, device=device, dtype=torch.float32)
473
+ ys = torch.arange(res, device=device, dtype=torch.float32)
474
+ yv, xv = torch.meshgrid(ys, xs, indexing="ij")
475
+
476
+ x_cam = (xv - cx) / fx
477
+ y_cam = -(yv - cy) / fy
478
+ z_cam = torch.ones_like(x_cam)
479
+
480
+ dirs_cam = torch.stack([x_cam, y_cam, z_cam], dim=-1)
481
+ dirs_cam = dirs_cam / torch.clamp(torch.norm(dirs_cam, dim=-1, keepdim=True), min=1e-9)
482
+
483
+ R = torch.tensor(R_cw, device=device, dtype=torch.float32)
484
+ dirs_world = torch.einsum("ij,hwj->hwi", R, dirs_cam)
485
+
486
+ return dirs_world
487
+
488
+
489
+ @torch.no_grad()
490
+ def compute_coverage_mask(
491
+ slices: List[TangentSlice],
492
+ erp_h: int,
493
+ erp_w: int,
494
+ device: torch.device,
495
+ ) -> Tuple[np.ndarray, Dict[str, float]]:
496
+ """
497
+ 计算 ERP 覆盖率掩码(纯几何计算)
498
+
499
+ Returns:
500
+ coverage_mask: (H, W) uint8, 255=covered, 0=uncovered
501
+ stats: 覆盖率统计字典
502
+ """
503
+ coverage = torch.zeros(erp_h, erp_w, device=device, dtype=torch.float32)
504
+
505
+ for s in slices:
506
+ res = s.resolution
507
+ K = s.K
508
+ R_cw = s.R_cw
509
+
510
+ fx, fy = float(K[0, 0]), float(K[1, 1])
511
+ cx, cy = float(K[0, 2]), float(K[1, 2])
512
+
513
+ xs = torch.arange(res, device=device, dtype=torch.float32)
514
+ ys = torch.arange(res, device=device, dtype=torch.float32)
515
+ yv, xv = torch.meshgrid(ys, xs, indexing="ij")
516
+
517
+ x_cam = (xv - cx) / fx
518
+ y_cam = -(yv - cy) / fy
519
+ z_cam = torch.ones_like(x_cam)
520
+
521
+ dirs_cam = torch.stack([x_cam, y_cam, z_cam], dim=-1)
522
+ dirs_cam = dirs_cam / torch.clamp(torch.norm(dirs_cam, dim=-1, keepdim=True), min=1e-9)
523
+
524
+ R = torch.tensor(R_cw, device=device, dtype=torch.float32)
525
+ dirs_world = torch.einsum("ij,hwj->hwi", R, dirs_cam)
526
+
527
+ x = dirs_world[..., 0]
528
+ y = dirs_world[..., 1]
529
+ z = dirs_world[..., 2]
530
+
531
+ lon = torch.atan2(x, z)
532
+ lat = torch.asin(torch.clamp(y, -1.0, 1.0))
533
+
534
+ u = (lon + math.pi) / (2.0 * math.pi) * float(erp_w)
535
+ v = (math.pi / 2.0 - lat) / math.pi * float(erp_h - 1)
536
+
537
+ u_int = torch.round(u).to(torch.int64)
538
+ v_int = torch.round(v).to(torch.int64)
539
+
540
+ u_int = torch.clamp(u_int % erp_w, 0, erp_w - 1)
541
+ v_int = torch.clamp(v_int, 0, erp_h - 1)
542
+
543
+ idx = v_int * erp_w + u_int
544
+ idx = idx.reshape(-1)
545
+
546
+ coverage_flat = coverage.reshape(-1)
547
+ coverage_flat.scatter_add_(0, idx, torch.ones_like(idx, dtype=torch.float32))
548
+
549
+ covered = coverage > 0
550
+ coverage_mask = (covered.float() * 255).byte().cpu().numpy()
551
+
552
+ total_pixels = erp_h * erp_w
553
+ covered_pixels = int(covered.sum().item())
554
+
555
+ pole_rows = int(erp_h * 0.1)
556
+ north_covered = covered[:pole_rows, :].float().mean().item()
557
+ south_covered = covered[-pole_rows:, :].float().mean().item()
558
+
559
+ stats = {
560
+ "total_coverage": covered_pixels / total_pixels * 100,
561
+ "uncovered_pixels": total_pixels - covered_pixels,
562
+ "north_pole_coverage": north_covered * 100,
563
+ "south_pole_coverage": south_covered * 100,
564
+ }
565
+
566
+ return coverage_mask, stats
code/data/README.md ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Data Directory
2
+
3
+ Place local scene assets here when running experiments. Do not commit dataset files to the anonymous repository.
4
+
5
+ Recommended layout:
6
+
7
+ ```text
8
+ data/
9
+ ├── blender_indoor/
10
+ ├── blender_outdoor/
11
+ ├── hm3d/
12
+ └── scannetpp/
13
+ ```
14
+
15
+ You may also pass absolute paths directly to the pipeline CLI.
16
+
code/dataset_metadata/croissant.json ADDED
@@ -0,0 +1,308 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "@context": {
3
+ "@language": "en",
4
+ "@vocab": "https://schema.org/",
5
+ "citeAs": "cr:citeAs",
6
+ "column": "cr:column",
7
+ "conformsTo": "dct:conformsTo",
8
+ "cr": "http://mlcommons.org/croissant/",
9
+ "rai": "http://mlcommons.org/croissant/RAI/",
10
+ "data": {
11
+ "@id": "cr:data",
12
+ "@type": "@json"
13
+ },
14
+ "dataType": {
15
+ "@id": "cr:dataType",
16
+ "@type": "@vocab"
17
+ },
18
+ "dct": "http://purl.org/dc/terms/",
19
+ "examples": {
20
+ "@id": "cr:examples",
21
+ "@type": "@json"
22
+ },
23
+ "extract": "cr:extract",
24
+ "field": "cr:field",
25
+ "fileProperty": "cr:fileProperty",
26
+ "fileObject": "cr:fileObject",
27
+ "fileSet": "cr:fileSet",
28
+ "format": "cr:format",
29
+ "includes": "cr:includes",
30
+ "isLiveDataset": "cr:isLiveDataset",
31
+ "jsonPath": "cr:jsonPath",
32
+ "key": "cr:key",
33
+ "md5": "cr:md5",
34
+ "parentField": "cr:parentField",
35
+ "path": "cr:path",
36
+ "recordSet": "cr:recordSet",
37
+ "references": "cr:references",
38
+ "regex": "cr:regex",
39
+ "repeated": "cr:repeated",
40
+ "replace": "cr:replace",
41
+ "samplingRate": "cr:samplingRate",
42
+ "sc": "https://schema.org/",
43
+ "separator": "cr:separator",
44
+ "source": "cr:source",
45
+ "subField": "cr:subField",
46
+ "transform": "cr:transform"
47
+ },
48
+ "@type": "sc:Dataset",
49
+ "conformsTo": "http://mlcommons.org/croissant/1.0",
50
+ "name": "CM-EVS",
51
+ "description": "CM-EVS is a curated panoramic RGB-D dataset built under a single principle: maximize the geometric coverage of a 3D scene with the fewest equirectangular (ERP) frames possible. The headline release contains 11,583 ERP RGB-depth-pose frames over 326 Blender indoor scenes (CC-BY 4.0), each paired with the per-step provenance log of the depth-conflict-aware curator that selected it. The full v1.0 release additionally provides 786,344 frames re-encoded from TartanGround (783,944 frames over 63 environments) and OB3D (2,400 frames over 12 scenes) outdoor sources into the same ERP and world-to-camera pose schema, plus license-aware adapter packages for HM3D (14,475 frames over 401 rooms after local regeneration) and ScanNet++ (8,267 frames over 500 scans after local regeneration) that produce matched frames locally without redistributing licensed assets.",
52
+ "version": "1.0.0",
53
+ "license": "https://creativecommons.org/licenses/by/4.0/",
54
+ "url": "https://anonymous.4open.science/r/cmevs-XXXX",
55
+ "citeAs": "@inproceedings{cmevs2026, title={{CM-EVS}: A Coverage-Curated Panoramic {RGB-D} Dataset for Indoor Scene Understanding}, author={Anonymous Author(s)}, booktitle={NeurIPS 2026 Datasets and Benchmarks Track (under review)}, year={2026}}",
56
+ "creator": {
57
+ "@type": "Organization",
58
+ "name": "Anonymous (double-blind submission)"
59
+ },
60
+ "datePublished": "2026-05-01",
61
+ "keywords": [
62
+ "panoramic",
63
+ "equirectangular",
64
+ "ERP",
65
+ "RGB-D",
66
+ "view planning",
67
+ "fixed-budget",
68
+ "data-centric",
69
+ "viewpoint provenance",
70
+ "indoor scene understanding",
71
+ "panoramic depth estimation",
72
+ "novel view synthesis",
73
+ "world model pretraining"
74
+ ],
75
+ "isLiveDataset": false,
76
+ "distribution": [
77
+ {
78
+ "@type": "cr:FileObject",
79
+ "@id": "blender-indoor-archive.tar",
80
+ "name": "blender-indoor-archive.tar",
81
+ "contentUrl": "https://anonymous.4open.science/r/cmevs-XXXX/blender_indoor.tar",
82
+ "encodingFormat": "application/x-tar",
83
+ "sha256": "TODO_SHA256"
84
+ },
85
+ {
86
+ "@type": "cr:FileSet",
87
+ "@id": "blender-indoor-rgb",
88
+ "name": "blender-indoor-rgb",
89
+ "containedIn": {"@id": "blender-indoor-archive.tar"},
90
+ "encodingFormat": "image/png",
91
+ "includes": "rgb/*.png"
92
+ },
93
+ {
94
+ "@type": "cr:FileSet",
95
+ "@id": "blender-indoor-depth",
96
+ "name": "blender-indoor-depth",
97
+ "containedIn": {"@id": "blender-indoor-archive.tar"},
98
+ "encodingFormat": "application/octet-stream",
99
+ "includes": "depth/*.npy"
100
+ },
101
+ {
102
+ "@type": "cr:FileSet",
103
+ "@id": "blender-indoor-pose",
104
+ "name": "blender-indoor-pose",
105
+ "containedIn": {"@id": "blender-indoor-archive.tar"},
106
+ "encodingFormat": "application/json",
107
+ "includes": "pose/*.json"
108
+ },
109
+ {
110
+ "@type": "cr:FileSet",
111
+ "@id": "blender-indoor-metadata",
112
+ "name": "blender-indoor-metadata",
113
+ "containedIn": {"@id": "blender-indoor-archive.tar"},
114
+ "encodingFormat": "application/json",
115
+ "includes": "metadata/*.json*"
116
+ },
117
+ {
118
+ "@type": "cr:FileObject",
119
+ "@id": "outdoor-tartanground-adapter.tar",
120
+ "name": "outdoor-tartanground-adapter.tar",
121
+ "contentUrl": "https://anonymous.4open.science/r/cmevs-XXXX/outdoor_tartanground_adapter.tar",
122
+ "encodingFormat": "application/x-tar",
123
+ "sha256": "TODO_SHA256"
124
+ },
125
+ {
126
+ "@type": "cr:FileObject",
127
+ "@id": "outdoor-ob3d-adapter.tar",
128
+ "name": "outdoor-ob3d-adapter.tar",
129
+ "contentUrl": "https://anonymous.4open.science/r/cmevs-XXXX/outdoor_ob3d_adapter.tar",
130
+ "encodingFormat": "application/x-tar",
131
+ "sha256": "TODO_SHA256"
132
+ },
133
+ {
134
+ "@type": "cr:FileObject",
135
+ "@id": "hm3d-adapter.tar",
136
+ "name": "hm3d-adapter.tar",
137
+ "contentUrl": "https://anonymous.4open.science/r/cmevs-XXXX/hm3d_adapter.tar",
138
+ "encodingFormat": "application/x-tar",
139
+ "sha256": "TODO_SHA256"
140
+ },
141
+ {
142
+ "@type": "cr:FileObject",
143
+ "@id": "scannetpp-adapter.tar",
144
+ "name": "scannetpp-adapter.tar",
145
+ "contentUrl": "https://anonymous.4open.science/r/cmevs-XXXX/scannetpp_adapter.tar",
146
+ "encodingFormat": "application/x-tar",
147
+ "sha256": "TODO_SHA256"
148
+ },
149
+ {
150
+ "@type": "cr:FileObject",
151
+ "@id": "curator-source-code.tar",
152
+ "name": "curator-source-code.tar",
153
+ "contentUrl": "https://anonymous.4open.science/r/cmevs-XXXX/code.tar",
154
+ "encodingFormat": "application/x-tar",
155
+ "sha256": "TODO_SHA256"
156
+ },
157
+ {
158
+ "@type": "cr:FileObject",
159
+ "@id": "documentation.tar",
160
+ "name": "documentation.tar",
161
+ "contentUrl": "https://anonymous.4open.science/r/cmevs-XXXX/docs.tar",
162
+ "encodingFormat": "application/x-tar",
163
+ "sha256": "TODO_SHA256"
164
+ },
165
+ {
166
+ "@type": "cr:FileObject",
167
+ "@id": "frame-manifest.csv",
168
+ "name": "frame-manifest.csv",
169
+ "contentUrl": "https://anonymous.4open.science/r/cmevs-XXXX/frame_manifest.csv",
170
+ "encodingFormat": "text/csv",
171
+ "sha256": "TODO_SHA256"
172
+ }
173
+ ],
174
+ "recordSet": [
175
+ {
176
+ "@type": "cr:RecordSet",
177
+ "@id": "erp-frame-records",
178
+ "name": "erp-frame-records",
179
+ "description": "One record per released ERP frame. Curator-only fields (viewpoint_score, coverage_gain, conflict_ratio, candidate_id) are populated only for frames produced by the depth-conflict-aware curator; outdoor re-encoded frames carry the schema fields without per-step provenance.",
180
+ "field": [
181
+ {
182
+ "@type": "cr:Field",
183
+ "@id": "erp-frame-records/frame_id",
184
+ "name": "frame_id",
185
+ "dataType": "sc:Text",
186
+ "source": {"fileObject": {"@id": "frame-manifest.csv"}, "extract": {"column": "frame_id"}}
187
+ },
188
+ {
189
+ "@type": "cr:Field",
190
+ "@id": "erp-frame-records/source",
191
+ "name": "source",
192
+ "dataType": "sc:Text",
193
+ "source": {"fileObject": {"@id": "frame-manifest.csv"}, "extract": {"column": "source"}}
194
+ },
195
+ {
196
+ "@type": "cr:Field",
197
+ "@id": "erp-frame-records/scene_id",
198
+ "name": "scene_id",
199
+ "dataType": "sc:Text",
200
+ "source": {"fileObject": {"@id": "frame-manifest.csv"}, "extract": {"column": "scene_id"}}
201
+ },
202
+ {
203
+ "@type": "cr:Field",
204
+ "@id": "erp-frame-records/room_id",
205
+ "name": "room_id",
206
+ "dataType": "sc:Text",
207
+ "source": {"fileObject": {"@id": "frame-manifest.csv"}, "extract": {"column": "room_id"}}
208
+ },
209
+ {
210
+ "@type": "cr:Field",
211
+ "@id": "erp-frame-records/split",
212
+ "name": "split",
213
+ "dataType": "sc:Text",
214
+ "source": {"fileObject": {"@id": "frame-manifest.csv"}, "extract": {"column": "split"}}
215
+ },
216
+ {
217
+ "@type": "cr:Field",
218
+ "@id": "erp-frame-records/rgb",
219
+ "name": "rgb",
220
+ "dataType": "sc:ImageObject",
221
+ "source": {"fileObject": {"@id": "frame-manifest.csv"}, "extract": {"column": "rgb_path"}}
222
+ },
223
+ {
224
+ "@type": "cr:Field",
225
+ "@id": "erp-frame-records/depth",
226
+ "name": "depth",
227
+ "dataType": "sc:Text",
228
+ "source": {"fileObject": {"@id": "frame-manifest.csv"}, "extract": {"column": "depth_path"}}
229
+ },
230
+ {
231
+ "@type": "cr:Field",
232
+ "@id": "erp-frame-records/pose_quaternion",
233
+ "name": "pose_quaternion",
234
+ "dataType": "sc:Text",
235
+ "source": {"fileObject": {"@id": "frame-manifest.csv"}, "extract": {"column": "pose_quaternion"}}
236
+ },
237
+ {
238
+ "@type": "cr:Field",
239
+ "@id": "erp-frame-records/pose_position",
240
+ "name": "pose_position",
241
+ "dataType": "sc:Text",
242
+ "source": {"fileObject": {"@id": "frame-manifest.csv"}, "extract": {"column": "pose_position"}}
243
+ },
244
+ {
245
+ "@type": "cr:Field",
246
+ "@id": "erp-frame-records/camera_type",
247
+ "name": "camera_type",
248
+ "dataType": "sc:Text",
249
+ "source": {"fileObject": {"@id": "frame-manifest.csv"}, "extract": {"column": "camera_type"}}
250
+ },
251
+ {
252
+ "@type": "cr:Field",
253
+ "@id": "erp-frame-records/viewpoint_score",
254
+ "name": "viewpoint_score",
255
+ "dataType": "sc:Float",
256
+ "source": {"fileObject": {"@id": "frame-manifest.csv"}, "extract": {"column": "viewpoint_score"}}
257
+ },
258
+ {
259
+ "@type": "cr:Field",
260
+ "@id": "erp-frame-records/coverage_gain",
261
+ "name": "coverage_gain",
262
+ "dataType": "sc:Float",
263
+ "source": {"fileObject": {"@id": "frame-manifest.csv"}, "extract": {"column": "coverage_gain"}}
264
+ },
265
+ {
266
+ "@type": "cr:Field",
267
+ "@id": "erp-frame-records/conflict_ratio",
268
+ "name": "conflict_ratio",
269
+ "dataType": "sc:Float",
270
+ "source": {"fileObject": {"@id": "frame-manifest.csv"}, "extract": {"column": "conflict_ratio"}}
271
+ },
272
+ {
273
+ "@type": "cr:Field",
274
+ "@id": "erp-frame-records/candidate_id",
275
+ "name": "candidate_id",
276
+ "dataType": "sc:Text",
277
+ "source": {"fileObject": {"@id": "frame-manifest.csv"}, "extract": {"column": "candidate_id"}}
278
+ }
279
+ ]
280
+ }
281
+ ],
282
+ "rai:dataCollection": "Indoor data is produced by the CM-EVS pipeline (asset loading, coordinate normalization, candidate generation, 26-direction geometric-validity filtering, conflict-aware greedy selection, 2048x1024 high-resolution Cycles ERP rendering, export under the unified schema). Outdoor data is sourced from TartanGround and OB3D and re-encoded into the unified schema; the curator is not run on outdoor sources in v1.0. HM3D and ScanNet++ frames are not redistributed; the release ships adapter regeneration scripts.",
283
+ "rai:dataPreprocessingProtocol": "Coordinate normalization to a right-handed +X-right, +Y-up, +Z-forward world frame with the OpenCV-style camera frame; pose stored as a scalar-first world-to-camera quaternion plus a position relative to the scene's first selected frame. AABB computation; source-specific candidate generation; 26-direction geometric-validity filter. Cubemap-to-ERP re-encoding at native resolution for outdoor sources; optional exposure adjustment for Blender; output schema conversion. Candidate probes, intermediate caches, pre-render-all oracle frames, and locally regenerated HM3D / ScanNet++ outputs are excluded from the public frame count F_pub.",
284
+ "rai:dataAnnotationProtocol": "No human annotation is performed. All labels (split, source, scene id, viewpoint score, coverage gain, conflict ratio) are produced automatically by the curator pipeline and recorded in metadata/per_step_log.jsonl and metadata/selected_viewpoints.json.",
285
+ "rai:dataReleaseMaintenancePlan": "Versioned releases on a 6-month cadence. Errata tracked via the project repository; SHA256 manifests refreshed at every release; HM3D and ScanNet++ regeneration scripts updated when upstream APIs, file layouts, or access terms change.",
286
+ "rai:dataUseCases": [
287
+ "Panoramic depth estimation",
288
+ "ERP novel-view synthesis",
289
+ "Panoramic Gaussian-splatting reconstruction",
290
+ "Panoramic world-model pretraining",
291
+ "Fixed-budget viewpoint policy evaluation"
292
+ ],
293
+ "rai:dataLimitations": [
294
+ "Real-scan derived frames (HM3D, ScanNet++) are not redistributed; users must accept upstream license terms and regenerate locally.",
295
+ "Outdoor frames are re-encoded source trajectories rather than curator-selected subsets and therefore do not carry per-step provenance.",
296
+ "Synthetic-real transfer must be validated separately by source; we do not claim Blender-only gains imply real-scan gains.",
297
+ "Geometry-validity filters may fail in atria, semi-outdoor spaces, narrow transitions, noisy scans, or pure point-cloud scenes."
298
+ ],
299
+ "rai:personalSensitiveInformation": "No new personal data is collected. Real-scan sources (HM3D, ScanNet++) may depict private indoor layouts and are not redistributed as derived frames. Even regeneration scripts and viewpoint metadata can reveal where observations would be sampled within a private space; users must comply with upstream source access terms.",
300
+ "rai:dataBiases": [
301
+ "Source assets inherit geographic, architectural, and scanning biases.",
302
+ "HM3D and ScanNet++ are skewed toward scanned residential indoor spaces.",
303
+ "Blender assets are skewed toward staged residential, office, and architectural scenes.",
304
+ "Outdoor sources (TartanGround, OB3D) are skewed toward simulator-generated terrain along circular trajectories.",
305
+ "Synthetic Blender materials may not match real-scan sensor noise."
306
+ ],
307
+ "rai:dataSocialImpact": "CM-EVS lowers the engineering cost of producing auditable panoramic RGB-D resources from existing 3D scenes. Positive uses include panoramic perception, data-centric evaluation, view-planning research, and 3D-consistent world-model pretraining. Potential harms include over-trusting synthetic data, obscuring upstream dataset bias, and using real indoor scans in privacy-sensitive settings. The release therefore separates public synthetic frames from licensed real-scan regeneration and documents intended uses, non-uses, and source licenses."
308
+ }
code/environment.yml ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: cmevs
2
+ channels:
3
+ - pytorch
4
+ - nvidia
5
+ - conda-forge
6
+ dependencies:
7
+ - python=3.10
8
+ - pip
9
+ - numpy>=1.24
10
+ - scipy
11
+ - pandas
12
+ - pyyaml
13
+ - pillow
14
+ - matplotlib
15
+ - scikit-learn
16
+ - pytorch
17
+ - torchvision
18
+ - cudatoolkit
19
+ - pip:
20
+ - opencv-python
21
+ - open3d
22
+ - trimesh
23
+ - tqdm
24
+ - jsonschema
25
+
code/examples/metadata/candidates.jsonl ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ {"candidate_id":"tiny_000","source":"blender_indoor_tiny","scene_id":"tiny_blend_scene","position":[0.0,1.6,0.0],"yaw_deg":0.0,"valid":true,"rejection_layer":"accepted","single_view_probe_coverage":0.31,"conflict_prior":0.05,"covered_cells":["a","b","c","d"],"oracle_gain":0.30,"runtime_s":0.02}
2
+ {"candidate_id":"tiny_001","source":"blender_indoor_tiny","scene_id":"tiny_blend_scene","position":[1.0,1.6,0.0],"yaw_deg":45.0,"valid":true,"rejection_layer":"accepted","single_view_probe_coverage":0.34,"conflict_prior":0.12,"covered_cells":["c","d","e","f","g"],"oracle_gain":0.28,"runtime_s":0.02}
3
+ {"candidate_id":"tiny_002","source":"blender_indoor_tiny","scene_id":"tiny_blend_scene","position":[2.0,1.6,0.5],"yaw_deg":90.0,"valid":true,"rejection_layer":"accepted","single_view_probe_coverage":0.27,"conflict_prior":0.02,"covered_cells":["h","i","j"],"oracle_gain":0.24,"runtime_s":0.02}
4
+ {"candidate_id":"tiny_003","source":"blender_indoor_tiny","scene_id":"tiny_blend_scene","position":[0.5,1.6,1.5],"yaw_deg":135.0,"valid":true,"rejection_layer":"accepted","single_view_probe_coverage":0.22,"conflict_prior":0.18,"covered_cells":["a","k","l"],"oracle_gain":0.16,"runtime_s":0.02}
5
+ {"candidate_id":"tiny_004","source":"blender_indoor_tiny","scene_id":"tiny_blend_scene","position":[1.5,1.6,1.5],"yaw_deg":180.0,"valid":true,"rejection_layer":"accepted","single_view_probe_coverage":0.29,"conflict_prior":0.06,"covered_cells":["m","n","o","p"],"oracle_gain":0.26,"runtime_s":0.02}
6
+ {"candidate_id":"tiny_005","source":"blender_indoor_tiny","scene_id":"tiny_blend_scene","position":[3.0,1.6,1.5],"yaw_deg":270.0,"valid":false,"rejection_layer":"visibility","single_view_probe_coverage":0.04,"conflict_prior":0.35,"covered_cells":[],"oracle_gain":0.01,"runtime_s":0.01}
7
+