File size: 2,733 Bytes
30841e1 6427d9d 30841e1 6427d9d 30841e1 4abeb6f 30841e1 6427d9d 30841e1 6427d9d 30841e1 8bba3f8 4abeb6f | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | # Scripts
Utilities for direct online final-graph runs from an HF checkout.
```text
setup_realtime_final_graph_env.sh # create/update a conda env with RoboCasa, torch, SAM2 code, and OpenAI CLIP
verify_realtime_final_graph.py # run one live RoboCasa OpenDrawer final-graph smoke and assert D_node=342
verify_rgb_graph_alignment.py # verify graph/view masks/RGB alignment and saved rgb_manifest round-trip
```
The verifier uses bundled model checkpoints by default:
```text
models/sam2/checkpoints/sam2.1_hiera_base_plus.pt
models/clip/ViT-B-32.pt
```
RoboCasa simulator assets are not redistributed here; follow upstream RoboCasa setup for assets.
## Multi-view RGB / graph alignment contract
For joint training, evaluation, and real-time inference, the model-facing online call is:
```python
snapshot = extractor.extract_final_graph(visual_backend=visual_backend)
graph = snapshot["gnn_graph"] # x [N_real,342], edge_attr [E,8]
rgb_frames = snapshot["rgb_frames"] # dict: view_id -> uint8[256,256,3]
rgb_frame_cameras = snapshot["rgb_frame_cameras"] # ordered camera names for those view ids
```
All fields in one `snapshot` are produced from the same current simulator state before the policy/env step advances:
```text
current qpos/qvel/contact state
+ current segmentation renders from the ordered camera list
+ current RGB renders from the same ordered camera list
+ current visible RLE masks indexed by (node slot n, view id v)
+ SAM2 masked pooling on rgb_frames[v] using that same mask
= final graph x [N_real,342]
```
The ordered multi-view camera contract is:
```text
v=0 robot0_agentview_right
v=1 robot0_agentview_left
v=2 robot0_eye_in_hand
```
Alignment rules for downstream integration:
- `view_visible[n,v]`, `view_centroid[n,v]`, `view_area[n,v]`, `view_bbox[n,v]`, `rle_masks[*]["v"]`, `visual_features_sparse["v"]`, and `rgb_frames[v]` use the same view id.
- `visual_features_sparse["n"]` uses the original padded node slot id; `gnn_graph["slot_ids"]` maps active GNN rows back to those padded slots.
- `rgb_frames[v]` is an upright `uint8[256,256,3]` RGB frame rendered with the same vertical flip convention as the segmentation/mask path.
- `save_realtime_graph_snapshot(snapshot, out_dir)` writes `rgb/view_<v>_<camera>.npy` plus `rgb_manifest.json`, so saved debug/eval snapshots contain graph data first and aligned RGB images alongside it.
Alignment gate:
```bash
MUJOCO_GL=egl PYOPENGL_PLATFORM=egl python scripts/verify_rgb_graph_alignment.py
```
This uses a deterministic fake visual backend by default so it checks graph/RGB/mask plumbing without requiring SAM2. Use `verify_realtime_final_graph.py --visual-backend sam2` for the real SAM2/CLIP gate.
|