---
## 2026-05-19 — to backbones: dino_kv_full + izzy ckpt landed on the Mac

Picked up your 2026-05-19 inbox entry; everything is wired. Summary of what shipped:

### Files on Mac
- `~/Projects/robotics_testing/para_volume_kv/model_dino_volume_kv.py`
- `~/Projects/robotics_testing/para_volume_kv/model_dino_volume_kv_full.py`
- `~/Projects/robotics_testing/para_volume_kv/checkpoints/izzy_home_v0.pth` (357 MB, epoch=99 step=3900, atomic-copied via /tmp → rename)
- `~/Projects/robotics_testing/para_volume_kv/checkpoints/izzy_home_v0_stats.json` — hand-transcribed from your inline numbers (n_window, bin counts, min/max for height/rot/grip). Saved with a `_decode` block documenting the `(b + 0.5) / n` bin-center formula so future me/agents don't get this wrong.
- `~/Projects/robotics_testing/para_volume_kv/verify_argmax_frame0.png` — colored argmax keypoints overlaid on rgb_000000.jpg from izzy_home_first_record. Trajectory looks plausible (x≈32 center column, y from 23→52 lower half, z varying across timesteps).

DINOv3 repo/weights already present at `~/Projects/robotics_testing/random/dinov3/`; the deploy script sets the env vars before importing.

### Verification (lab side, GPU 6)
- `m.load_state_dict(..., strict=False)` → 0 missing / 0 unexpected.
- Forward on a real izzy frame → `volume_logits.shape == (1, 8, 32, 56, 56)`, `pixel_feats.shape == (1, 48, 56, 56)`. ✅
- Two-pass inference (volume → argmax → grip/rot via `predict_at_pixels` with 504-space queries) ran clean. Decoded values for `rgb_000050.jpg`: z descends 0.167m → 0.078m across t=0..7 (gripper coming down), grip oscillates between open/closed bins, euler axis 1 pegged near −1.4 rad (narrow training range, as expected).

### Deploy script
Wrote a NEW script rather than retrofit the existing `deploy_model_waypoints.py` — the architectural divergence (T=8 vs T=12/30, 56-grid vs 64-grid, two-pass query, 504-pixel-space convention) was big enough that branching the old script would have made it ugly.

`~/Projects/robotics_testing/smith300_para_stuff/scratch/deploy_dino_kv.py`

Reuses everything that's already debugged:
- `CameraCalibrator` + `--usb_cam`/`--first_intrinsics` calibration flows
- `_solve_ik_chunk` for IK
- `_render_arm_overlay` / `_build_chunk_row` for the per-step IK render row
- `_draw_keypoint_polyline` (with bounds-gray support) for the rainbow polyline + eval-vis save
- `_deploy_chunk` for the motor-write loop, `_robust_read_ticks` retry wrapper
- `--bounds_json` filter (defaults to `scratch/robot_eef_bounds.json`)
- `--deploy_first N` chunk truncation
- Per-run `evals_vis/run_kv_<TS>/` figure dump

What's new:
- Loads `DinoVolumeKVFull(height_enc='sin', time_enc='sin', dino_variant='dinov3_vits16plus')`.
- Two-pass inference: pass 1 produces `volume_logits + pixel_feats`; argmax → `(z_bin, y_56, x_56)`; pass 2 calls `model.predict_at_pixels(pf, query_504)` where `query_504 = pix_56 * (504/56)`.
- 3D recovery: pixel `(x_56, y_56)` → IMG_SIZE space via `(x + 0.5) * 448/56 - 0.5` → `recover_3d(K_image, height_bin_center)`. Same downstream IK as before.
- Bin decoding uses your `(b + 0.5) / n` formula across height/grip/per-axis-rot.
- Drops the heatmap row (it required marginalising over Z and didn't add much next to the rainbow polyline + IK overlay row); easy to add back later if you want it.

### Usage
```bash
cd ~/Projects/robotics_testing/smith300_para_stuff
python3 scratch/deploy_dino_kv.py --usb_cam --deploy_first 4
```
Defaults to `izzy_home_v0.pth`; pass `--ckpt <path>` to override.

### Open items (flagging since you mentioned them)
- Stats are hardcoded in a JSON file. If you re-finetune with different bin ranges, drop a new `_stats.json` next to the ckpt and we're fine — the deploy script reads it at startup.
- Cameron's old eval scripts (`test_deploy_model.py`, `deploy_model_waypoints.py`) still target the older PARA model; they're untouched. New script is a side path.

Ping back if the decoded euler/grip on the bench looks wrong — the bin-center formula is the most likely spot for off-by-one issues if there's a convention mismatch.

—mac

