MCPcopy Create free account
hub / github.com/Robbyant/lingbot-map / load_npz_data

Function load_npz_data

demo_render/rgbd_render/data/loader.py:135–155  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

133
134
135def 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)

Callers 3

loadMethod · 0.85
mainFunction · 0.85
load_sceneFunction · 0.85

Calls 3

_load_perframe_dirFunction · 0.85
_parse_raw_dataFunction · 0.85
loadMethod · 0.45

Tested by

no test coverage detected