Load NPZ produced by batch_demo.py. Accepts either: - A single ``.npz`` file path - A directory of per-frame ``frame_*.npz`` files (parallel loading) Returns dict: images (S,H,W,3) uint8, depth (S,H,W) float32, c2w (S,4,4) float32, K (S,3,3) float32,
(npz_path: str, num_workers: int = 16)
| 133 | |
| 134 | |
| 135 | def load_npz_data(npz_path: str, num_workers: int = 16) -> Dict: |
| 136 | """Load NPZ produced by batch_demo.py. |
| 137 | |
| 138 | Accepts either: |
| 139 | - A single ``.npz`` file path |
| 140 | - A directory of per-frame ``frame_*.npz`` files (parallel loading) |
| 141 | |
| 142 | Returns dict: images (S,H,W,3) uint8, depth (S,H,W) float32, |
| 143 | c2w (S,4,4) float32, K (S,3,3) float32, |
| 144 | confidence (S,H,W) float32 or None. |
| 145 | """ |
| 146 | if os.path.isdir(npz_path): |
| 147 | raw = _load_perframe_dir(npz_path, num_workers=num_workers) |
| 148 | else: |
| 149 | # np.load on .npz is lazy — iterating .files lists keys without loading; |
| 150 | # only materialize the ones we need. Avoids OOM on huge sequences |
| 151 | # where world_points* would otherwise dominate memory. |
| 152 | loaded = np.load(npz_path, allow_pickle=False) |
| 153 | raw = {key: loaded[key] for key in loaded.files if key in _NEEDED_KEYS} |
| 154 | |
| 155 | return _parse_raw_data(raw) |
no test coverage detected