MCPcopy Create free account
hub / github.com/Ropedia/SpatialBench / _collect_colors

Function _collect_colors

benchmark/utils/visualization.py:323–341  ·  view source on GitHub ↗

Collect pixel colors from each frame's image according to a mask. Args: images_raw: Tensor (N, 3, H, W) [0, 1] mask_per_frame: (N, H, W) bool Returns: (M, 3) float32

(images_raw, mask_per_frame)

Source from the content-addressed store, hash-verified

321
322
323def _collect_colors(images_raw, mask_per_frame):
324 """Collect pixel colors from each frame's image according to a mask.
325
326 Args:
327 images_raw: Tensor (N, 3, H, W) [0, 1]
328 mask_per_frame: (N, H, W) bool
329
330 Returns:
331 (M, 3) float32
332 """
333 colors = []
334 N = len(mask_per_frame)
335 for i in range(N):
336 mask = mask_per_frame[i]
337 if not mask.any():
338 continue
339 img = images_raw[i].permute(1, 2, 0).numpy()
340 colors.append(img[mask])
341 return np.concatenate(colors, axis=0) if colors else np.zeros((0, 3), dtype=np.float32)
342
343
344def save_scene_inputs(scene, inputs_dir):

Callers 15

visualize_predictionMethod · 0.90
visualize_predictionMethod · 0.90
visualize_predictionMethod · 0.90
visualize_predictionMethod · 0.90
visualize_predictionMethod · 0.90
predictMethod · 0.90
visualize_predictionMethod · 0.90
visualize_predictionMethod · 0.90
visualize_predictionMethod · 0.90
visualize_predictionMethod · 0.90
visualize_predictionMethod · 0.90
visualize_predictionMethod · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected