feat(scenegraph): add SceneGraphBuilder for pipeline-driven graph construction

Introduce SceneGraphBuilder + SceneGraphBuildConfig to decouple scene graph
construction from the verification notebook. The builder handles batch
inference, hash encoding, and object node creation internally.

- Add SceneGraphBuilder.build_from_room_views() as the main entry point
- Add SceneGraphBuildConfig for inference_batch_size and position strategy
- Add SceneGraphBuildArtifacts to carry cropped images and debug metadata
- Extend ObjectNode with optional detection metadata (label, confidence,
  bbox_xyxy, source_view_id, position_confidence)
- Add RoomView frozen dataclass as a structured view container
- Add flatten_room_views() utility to replace inline list comprehensions
- Refactor notebooks/verification.py to use the new builder API

BREAKING CHANGE: ObjectNode now accepts additional optional fields; direct
scene_graph.objects[obj_id] = ObjectNode(...) construction in the notebook
is replaced by builder.build_from_room_views(...).
This commit is contained in:
2026-05-30 15:40:58 +08:00
parent 97e53d44f8
commit a127032e18
8 changed files with 910 additions and 129 deletions

View File

@@ -5,6 +5,7 @@ This module exports the main scenegraph objects for easy import:
from scenegraph import SimpleSceneGraph, RoomNode, ObjectNode
"""
from .builder import SceneGraphBuildArtifacts, SceneGraphBuildConfig, SceneGraphBuilder
from .hash_codec import (
bits_tensor_to_cam_row,
bits_tensor_to_hash_bytes,
@@ -28,6 +29,9 @@ __all__ = [
"ImageSceneGraphQueryResult",
"ObjectNode",
"RoomNode",
"SceneGraphBuildArtifacts",
"SceneGraphBuildConfig",
"SceneGraphBuilder",
"SceneGraphMatch",
"SimpleSceneGraph",
"SoftwareCamIndex",