Skip to content
Python

docs: correct the label source throughout — released GT annotations, not teacher distillation

mohamdev620e3edf8662
diff --git a/README.md b/README.md
index 5220f09..3faecb4 100644
--- a/README.md
+++ b/README.md
@@ -2,11 +2,17 @@
![InstantHMR demo](models/instanthmr.gif)
-A lightweight, ONNX-exportable distillation of
+A lightweight, ONNX-exportable MHR body regressor for **3D human pose estimation
+and mesh recovery**: a RepViT-M1.5 backbone + a 9-token cross-attention decoder +
+CLIFF camera conditioning.
+
+It is trained on the **released ground-truth annotations** of
+[`facebook/sam-3d-body-dataset`](https://huggingface.co/datasets/facebook/sam-3d-body-dataset)
+— the human MHR fits used to build SAM 3D Body — predicting per-person MHR
+parameters and 70 keypoints from a single 224×224 crop. Distilling from
[`facebook/sam-3d-body-dinov3`](https://huggingface.co/facebook/sam-3d-body-dinov3)
-for **3D human pose estimation and mesh recovery**: a RepViT-M1.5 backbone + a 9-token
-cross-attention decoder + CLIFF camera conditioning. The model released by [`NaturalPad`](https://www.naturalpad.fr/) was trained to mimic the
-SAM3D teacher's per-person 70-keypoint outputs from a single 224×224 crop.
+by running the model over your own images is supported as an **option** (see
+[Training](#training)), but it is not how the shipped models were trained.
InstantHMR ships as a single `.onnx` file. The demo pipeline pairs it with
**RF-DETR** for person detection — both stages are timed independently so
@@ -315,13 +321,25 @@ exact same `images/*.png` + `annotations/*.npz` layout** that
[`notebooks/distill_transformer_decoder.ipynb`](notebooks/distill_transformer_decoder.ipynb)
consumes, so the training notebook is identical either way:
-1. **Distillation (default).** Run the SAM3D teacher over your own images with
+1. **Released ground-truth annotations — this is what every shipped model uses.**
+ Train directly on
+ [`facebook/sam-3d-body-dataset`](https://huggingface.co/datasets/facebook/sam-3d-body-dataset)
+ — the human MHR fits used to build SAM 3D Body — converted to the `.npz`
+ schema by [`tools/parquet_to_npz.py`](tools/parquet_to_npz.py) and laid out
+ by [`datasets_pipeline/build_split.py`](datasets_pipeline/build_split.py)
+ into `data/sam3d_gt_<dataset>/`. The cluster corpus is entirely of this kind
+ (sa1b / aic / harmony4d / coco / mpii).
+2. **Teacher distillation — an option, not the default.** Run
+ `facebook/sam-3d-body-dinov3` over your own images with
[`tools/annotate_dataset.py`](tools/annotate_dataset.py) to generate
per-person pseudo-labels — see [`docs/annotation.md`](docs/annotation.md).
-2. **Original ground-truth annotations.** Train directly on the released
- [`facebook/sam-3d-body-dataset`](https://huggingface.co/datasets/facebook/sam-3d-body-dataset)
- — the human MHR fits used to build SAM 3D Body — converted to the same
- `.npz` schema by [`tools/parquet_to_npz.py`](tools/parquet_to_npz.py).
+ This is the only thing that writes `data/sam3d_distill_mix/`. Use it to label
+ imagery the released dataset does not cover; note that it caps the student at
+ the teacher's own accuracy, which training on the ground truth does not.
+
+The trainer entry points and the `data/sam3d_distill_mix` directory keep
+"distill" in their names for historical reasons. The name does **not** mean the
+labels are teacher inference — only `tools/annotate_dataset.py` produces those.
### Train on the original annotations (COCO example)
@@ -422,7 +440,7 @@ prefixed per dataset, so they never collide.
(RepViT backbone, 9-query decoder, CLIFF condition).
- **[`docs/annotation.md`](docs/annotation.md)** — training data generation
with the SAM3D teacher.
-- **[`docs/training.md`](docs/training.md)** — distillation and ONNX export.
+- **[`docs/training.md`](docs/training.md)** — training and ONNX export.
## License
@@ -432,5 +450,5 @@ The code in this repository is released under the **Apache License 2.0**
The model weights distributed at
<https://huggingface.co/momolesang/InstantHMR> are released under the
[SAM license](https://github.com/facebookresearch/sam-3d-body), since
-InstantHMR is a distillation of `facebook/sam-3d-body-dinov3`. Please
+InstantHMR is trained on `facebook/sam-3d-body-dataset` labels. Please
review the SAM and RF-DETR licenses before downstream use.
diff --git a/benchmark/README.md b/benchmark/README.md
index 09b0974..edd7662 100644
--- a/benchmark/README.md
+++ b/benchmark/README.md
@@ -2,6 +2,13 @@
Evaluation harness for publishing numbers on `models/instanthmr_mhr_only_ckpt90.onnx`.
+> **A note on the word "teacher" below.** The models under test are trained on
+> the **released ground-truth annotations** of `facebook/sam-3d-body-dataset`,
+> not on teacher inference. Where this file says "teacher labels" or names a
+> file `adapter_*_teacher.npz`, it means *the dataset's own MHR annotations* —
+> the filenames are historical. Only `tools/annotate_dataset.py` produces
+> genuine teacher output, and it writes `data/sam3d_distill_mix/`.
+
Three benchmarks are implemented — two 3D, one 2D:
| Benchmark | What it measures | Data cost | Status |
@@ -404,7 +411,7 @@ which is the most recent one carrying every baseline:
Read that with the 18.8 mm conversion floor in mind: those baselines all predict
SMPL directly and pay no rig-conversion cost, and the floor already contains the
-teacher's own error. It is not separable from the model's error without perfect
+error in the dataset's own MHR fits. It is not separable from the model's error without perfect
MHR ground truth, so the honest statement is "53.8 mm, of which up to 18.8 mm is
the MHR→SMPL conversion", not a corrected number.
diff --git a/docs/accuracy_audit_2026-09-06.md b/docs/accuracy_audit_2026-09-06.md
index 9506bbf..596b888 100644
--- a/docs/accuracy_audit_2026-09-06.md
+++ b/docs/accuracy_audit_2026-09-06.md
@@ -1,5 +1,12 @@
Audit of the working tree on 6 September 2026
+> **Historical record — kept as written, not updated.** Read it as a snapshot of
+> 6 September 2026; several findings below were acted on or superseded later.
+> One terminology note: where this audit says "teacher" or "distillation" it
+> means the training *targets*, which are the released ground-truth annotations
+> of `facebook/sam-3d-body-dataset`, not inference from the
+> `sam-3d-body-dinov3` model. See `CLAUDE.md`, "What the training labels are".
+
The best opportunity is to improve what the student learns from its supervision before increasing the backbone. There are also confirmed evaluation/export defects that must be fixed before measuring a new method. Three research directions below could support separate papers, but their accuracy gains and novelty remain experimental questions; none is a guaranteed CVPR contribution.
Scope: inspected the current MHR-only trainer, DDP driver, augmentation and conversion code, evaluation, inference/export, available run configurations/results, and relevant primary research. Existing uncommitted changes were included in the audit and preserved. Numerical probes ran on CPU with the local TorchScript rig, local annotations, and the epoch-137 EMA checkpoint b3_s1. CUDA was unavailable to this process, so there was no new GPU timing, distributed reproduction, or training sweep. The small probes are diagnostics, not new benchmark results.
diff --git a/docs/annotation.md b/docs/annotation.md
index 7496f5b..60eae44 100644
--- a/docs/annotation.md
+++ b/docs/annotation.md
@@ -1,10 +1,21 @@
-# Building the training dataset
-
-InstantHMR is supervised entirely by the **SAM3D teacher**
+# Building a training dataset by teacher annotation (optional path)
+
+> **This page describes the OPTIONAL distillation path.** The default — and what
+> every shipped model and published number in this repo actually used — is the
+> released ground-truth annotations of
+> [`facebook/sam-3d-body-dataset`](https://huggingface.co/datasets/facebook/sam-3d-body-dataset),
+> laid out by `datasets_pipeline/build_split.py` into `data/sam3d_gt_<dataset>/`.
+> See `datasets_pipeline/README.md`.
+>
+> Use this page when you need labels for imagery the released dataset does not
+> cover. The cost is a ceiling: a model trained on teacher output cannot exceed
+> the teacher, while one trained on the ground truth can.
+
+On this path InstantHMR is supervised by the **SAM3D teacher**
(`facebook/sam-3d-body-dinov3`): for every detector-found person we run
the teacher and store its outputs alongside a tight 224×224 crop. The
-training loop in `notebooks/distill_transformer_decoder.ipynb` then learns
-to mimic those teacher outputs from the crop alone.
+training loop then learns to mimic those teacher outputs from the crop alone.
+This is the only thing that writes `data/sam3d_distill_mix/`.
The bundled `tools/annotate_dataset.py` uses YOLO for the
detector during annotation. That choice is independent of the runtime
diff --git a/docs/architecture.md b/docs/architecture.md
index e297f39..7c629b8 100644
--- a/docs/architecture.md
+++ b/docs/architecture.md
@@ -78,17 +78,23 @@ Both `joints_3d` and `cam_trans` are in metres in the SAM3D camera frame:
`[-1, 1]`; the demo's `instanthmr/inference.py` re-projects them to
full-frame pixels using the bbox-derived crop transform.
-## Why distill?
+## Why a small model at all?
-The DINOv3-based teacher is excellent but heavy: its tokenizer + decoder runs
-at <20 FPS on a desktop GPU and doesn't fit comfortably on edge hardware.
-Distillation gives us InstantHMR — a model that:
+SAM 3D Body is excellent but heavy: its DINOv3 tokenizer + decoder runs at
+<20 FPS on a desktop GPU and doesn't fit comfortably on edge hardware. Training
+a compact student on the **same ground-truth MHR annotations Meta used to build
+it** (`facebook/sam-3d-body-dataset`) gives us InstantHMR — a model that:
- runs at ~200 FPS on a single RTX 4070,
- exports to ONNX / TFLite / QNN, and
- preserves the SAM3D 70-keypoint & MHR outputs, so any downstream code that
consumed `pred_keypoints_3d` keeps working.
+Distilling from the `sam-3d-body-dinov3` model instead is an option
+(`tools/annotate_dataset.py`) and is useful for imagery the released dataset
+does not cover — but it caps the student at the teacher's accuracy, which
+training on the ground truth does not.
+
## Detection: RF-DETR
The demo pipeline uses **RF-DETR** (Roboflow's transformer-based detector)
diff --git a/docs/training.md b/docs/training.md
index 4642e7c..918fef5 100644
--- a/docs/training.md
+++ b/docs/training.md
@@ -1,5 +1,14 @@
# Training
+**Label source.** Training is supervised by the released ground-truth
+annotations of
+[`facebook/sam-3d-body-dataset`](https://huggingface.co/datasets/facebook/sam-3d-body-dataset)
+— the human MHR fits used to build SAM 3D Body — not by teacher inference.
+Distilling from `facebook/sam-3d-body-dinov3` with `tools/annotate_dataset.py`
+is an option for imagery the dataset does not cover; see
+[`docs/annotation.md`](annotation.md). The `train_distill_*.py` filenames are
+historical and say nothing about which labels you are using.
+
The InstantHMR training notebook is
[`notebooks/distill_transformer_decoder.ipynb`](../notebooks/distill_transformer_decoder.ipynb).
It is the source of truth for the notebook workflow — this page is a tour, not a
diff --git a/models/README.md b/models/README.md
index a947d37..721c67f 100644
--- a/models/README.md
+++ b/models/README.md
@@ -9,7 +9,7 @@ tags:
- human-mesh-recovery
- 3d-pose-estimation
- onnx
- - distillation
+ - mhr
- sam3d
- repvit
- cliff
@@ -20,12 +20,14 @@ base_model: facebook/sam-3d-body-dinov3
![InstantHMR demo](instanthmr.gif)
-A lightweight, ONNX-exportable distillation of
-[`facebook/sam-3d-body-dinov3`](https://huggingface.co/facebook/sam-3d-body-dinov3)
-for **3D human pose estimation and mesh recovery**: a RepViT-M1.5
-backbone + a 9-token cross-attention decoder + CLIFF camera conditioning.
-Trained to mimic the SAM3D teacher's per-person 70-keypoint outputs from
-a single 224×224 crop.
+A lightweight, ONNX-exportable MHR body regressor for **3D human pose
+estimation and mesh recovery**: a RepViT-M1.5 backbone + a 9-token
+cross-attention decoder + CLIFF camera conditioning.
+
+Trained on the released ground-truth annotations of
+[`facebook/sam-3d-body-dataset`](https://huggingface.co/datasets/facebook/sam-3d-body-dataset)
+— the human MHR fits used to build SAM 3D Body — predicting per-person MHR
+parameters and 70 keypoints from a single 224×224 crop.
Demo, training, and inference code live at the main InstantHMR
repository: <https://github.com/mohamdev/InstantHMR>.
@@ -35,7 +37,7 @@ repository: <https://github.com/mohamdev/InstantHMR>.
| File | Size | Purpose |
|---|---|---|
| `instanthmr.onnx` | ~77 MB | fp16 ONNX export — what the demo and `InstantHMR(...)` wrapper load. |
-| `instanthmr.pth` | ~461 MB | PyTorch checkpoint for fine-tuning / further distillation. |
+| `instanthmr.pth` | ~461 MB | PyTorch checkpoint for fine-tuning. |
Most users only need `instanthmr.onnx`. The `.pth` is included for people
who want to continue training, swap the head, or re-export with different
@@ -131,7 +133,7 @@ when you need vertices.
## License
These weights are released under the **SAM license**, since InstantHMR
-is a distillation of `facebook/sam-3d-body-dinov3`. Refer to
+is trained on `facebook/sam-3d-body-dataset` labels. Refer to
<https://github.com/facebookresearch/sam-3d-body> for the full license
text and applicable use restrictions.