Save the GT point cloud + camera frustums as a GLB file. All models share the same GT visualization function. Args: scene: dict from BenchmarkDataset output_dir: output directory
(scene, output_dir)
| 368 | |
| 369 | |
| 370 | def visualize_gt(scene, output_dir): |
| 371 | """Save the GT point cloud + camera frustums as a GLB file. |
| 372 | |
| 373 | All models share the same GT visualization function. |
| 374 | |
| 375 | Args: |
| 376 | scene: dict from BenchmarkDataset |
| 377 | output_dir: output directory |
| 378 | """ |
| 379 | scene_id = scene["scene_id"] |
| 380 | os.makedirs(output_dir, exist_ok=True) |
| 381 | |
| 382 | gt_depth = scene["depth"] |
| 383 | gt_poses = scene["extrinsic"] |
| 384 | gt_intrinsic = scene["intrinsic"] |
| 385 | valid_mask = scene["valid_mask"] |
| 386 | images_raw = scene["images_raw"] |
| 387 | N, _, H, W = images_raw.shape |
| 388 | |
| 389 | gt_points = unproject_to_pointcloud(gt_depth, gt_poses, gt_intrinsic, valid_mask) |
| 390 | if len(gt_points) > 0: |
| 391 | gt_colors = _collect_colors(images_raw, valid_mask) |
| 392 | gt_glb_path = os.path.join(output_dir, f"{scene_id}_gt.glb") |
| 393 | save_pointcloud_glb(gt_points, gt_colors, gt_glb_path, |
| 394 | extrinsics=gt_poses, intrinsics=gt_intrinsic, |
| 395 | frustum_scale=0.1, image_size=(W, H)) |
| 396 | print(f" GT -> {gt_glb_path} ({len(gt_points)} pts, {N} cams)") |
| 397 | |
| 398 | |
| 399 | def visualize_scene(scene, predictions, adapter, |
no test coverage detected