mirror of
https://github.com/huggingface/lerobot.git
synced 2026-07-24 10:16:09 +00:00
fix(rerun depth range): making rerun depth range computation safe against missing stats
This commit is contained in:
@@ -231,7 +231,9 @@ def visualize_dataset(
|
|||||||
# Use the dataset's q01/q99 depth statistics for robust depth range bounds
|
# Use the dataset's q01/q99 depth statistics for robust depth range bounds
|
||||||
depth_ranges = {}
|
depth_ranges = {}
|
||||||
for key in dataset.meta.depth_keys:
|
for key in dataset.meta.depth_keys:
|
||||||
stats = dataset.meta.stats[key]
|
stats = (dataset.meta.stats or {}).get(key)
|
||||||
|
if not stats:
|
||||||
|
continue
|
||||||
lo = stats["q01"] if "q01" in stats else stats["min"]
|
lo = stats["q01"] if "q01" in stats else stats["min"]
|
||||||
hi = stats["q99"] if "q99" in stats else stats["max"]
|
hi = stats["q99"] if "q99" in stats else stats["max"]
|
||||||
depth_ranges[key] = (float(np.asarray(lo).item()), float(np.asarray(hi).item()))
|
depth_ranges[key] = (float(np.asarray(lo).item()), float(np.asarray(hi).item()))
|
||||||
@@ -253,7 +255,7 @@ def visualize_dataset(
|
|||||||
depth_entity = rr.DepthImage(
|
depth_entity = rr.DepthImage(
|
||||||
depth,
|
depth,
|
||||||
colormap=rr.components.Colormap.Viridis,
|
colormap=rr.components.Colormap.Viridis,
|
||||||
depth_range=depth_ranges[key],
|
depth_range=depth_ranges.get(key),
|
||||||
)
|
)
|
||||||
rr.log(key, entity=depth_entity)
|
rr.log(key, entity=depth_entity)
|
||||||
else:
|
else:
|
||||||
|
|||||||
Reference in New Issue
Block a user