HBOrtiz's picture
add M2 toolkit data: 1445 embeddings, 0 face_labels
94e9182 verified
# Eval 3 — M2 ArcFace toolkit data
Training-time-only artifacts for the M2 ArcFace cosine-distillation loss
(`dev/m2-arcface-toolkit` branch).
**Inference contract is unchanged.** This data is consumed only inside
the training-time dataloader. The deployed policy graph contains
`SmolVLA` alone — no ArcFace, no RetinaFace, no InsightFace.
## Contents
| Path | What | Size |
|---|---|---|
| `celeb_embeddings.json` | Manifest: per-photo paths + per-celeb 512-D centroid (mean over the celeb's photos, L2-normalized) | ~3 MB |
| `arcface_embeddings/heldout/<celeb>/<photo>.arcface.npy` | Per-photo ArcFace `buffalo_l` embeddings for the 3 IID celebs' workspace photos (14 photos × 3 celebs) | ~30 KB |
| `arcface_embeddings/scraped/<celeb>/<photo>.arcface.npy` | Per-photo embeddings for 189 OOD celebs from the web-scraped bank | ~2.8 MB |
| `face_labels/<source_episode>.face_labels.json` | Per-frame face bboxes for one representative variant per source episode (151 sources × ~250 KB each) | ~39 MB |
## How it was built
1. **ArcFace cache:** `eval_3/aug/cache_arcface_embeddings.py` ran InsightFace
`buffalo_l` on every photo in `eval3_celebs/{heldout,scraped}/`,
keeping the largest detected face. 1,445 embeddings, 0 failures.
Leave-one-out top-1 identity recall on the full bank: **99.5 %**.
2. **Face labels:** `eval_3/aug/build_face_labels.py` grouped the 9,216
augmented variants by source-episode prefix (151 unique sources, ~60
variants each share camera trajectory because the camera is
fixed), ran RetinaFace at `det_size=640` and `stride=5` (linear bbox
interpolation between keyframes) on one representative camera1 video
per source, and emitted per-frame bboxes sorted left-to-right by
x-center.
## How to use at training time
```python
import json, numpy as np
from pathlib import Path
# Step 1: load the manifest
manifest = json.loads((repo_root / "celeb_embeddings.json").read_text())
# Step 2: per-celeb centroid for the alignment-loss target
def celeb_centroid(slug: str) -> np.ndarray:
return np.asarray(manifest["celebs"][slug]["centroid"], dtype=np.float32)
# Step 3: per-source bboxes
def load_face_labels(source_episode: str) -> dict:
p = repo_root / "face_labels" / f"{source_episode}.face_labels.json"
return json.loads(p.read_text())
# Step 4: at each training step, join via the variant's augmentation.json:
# - read augmentation.json[new_layout_camera_lmr] (e.g. "OLS")
# - look up "OLS" → [obama@left, lecun@middle, swift@right]
# - load face_labels[source].frames[frame_idx].bboxes (sorted left-to-right)
# - per-bbox supervision target = ArcFace centroid of the celeb at that slot
```
## Identity-matching reliability
The matcher (RetinaFace bbox → ArcFace embedding → nearest centroid in
the 192-celeb gallery) was validated under leave-one-out:
| Bucket (photos/celeb) | LOO top-1 | Mean top1−top2 margin |
|---|---|---|
| 2 | 100 % | +0.36 |
| 3–4 | 100 % | +0.59 |
| 5–7 | 100 % | +0.60 |
| 8–12 | 99.2 % | +0.60 |
| 13+ | 100 % | +0.68 |
The 7 misses (out of 1,445) cluster on one celeb (`oier_mees`) whose
scraped bank is structurally broken (intra-celeb own-photo cosines
0.05–0.13). Flag him before any reliance on OOD coverage.
## Branch & docs
- Source branch: [`dev/m2-arcface-toolkit`](https://github.com/Ace3Z/LeMonkey/tree/dev/m2-arcface-toolkit)
- Experiment log: `docs/experiments/2026-05-19_m2_data_foundation.md`
- Validation report: `docs/report/2026-05-18_m2_arcface_validation.md`