Evaluation & Metrics¶
This page explains every benchmark number reported in the PrimateFace paper in plain biological terms and documents the verified scripts in evals/ for evaluating detection and landmark models on your own data or on the canonical v1.0.0 test splits.
Do I need a GPU?
- Scoring saved predictions or plotting results (
score_scrfd_canonical_test.py,plot_genus_distribution.py,visualize_eval_results.py) runs in seconds on any laptop CPU. - Running model inference across thousands of test images (
eval_genera.py,evaluate_nme.py,evaluate_lpose_nme.py,evaluate_sleap_nme.py) is strongly recommended on an NVIDIA GPU or free Google Colab.
Plain-English Metrics Glossary¶
| Metric | What It Measures (No Jargon) | PrimateFace v1.0.0 Benchmark Anchor |
|---|---|---|
| IoU (Intersection over Union) | How tightly a predicted face box overlaps the true reference box (0.0 = no overlap, 1.0 = identical box). IoU ≥ 0.50 is a solid hit; IoU ≥ 0.75 is a tight hit. | Used as the match rule for all detection scores. |
| AP / AP@0.50 / AP@0.75 (Average Precision) | Combined detection score balancing precision (few false alarms on leaves, hands, or fur) and recall (few missed primate faces). AP averages across strict thresholds (IoU = 0.50 to 0.95). | Canonical RF-DETR-M on det_test (n = 23,897 images / 28,912 faces): AP = 0.670, AP@0.50 = 0.961, AP@0.75 = 0.774. |
| NME (Normalized Mean Error, % of face size) | Average pixel distance between predicted and reference visible landmarks, divided by face size (√(box width × box height)). Expressing error as a percentage makes small distant faces and large close-ups directly comparable. | Canonical ViTPose-L on pose_test (n = 15,814): 0.58% median NME — roughly 1.2 pixels on a 200 × 200-pixel face! |
| Macro-F1 | Average of precision and recall balance weighted equally across every class, so common genera (like Macaca) or common attribute states cannot hide poor accuracy on rare ones. | Used for 55-genus classification and the 6 observable facial attributes. |
| Group-Disjoint Splits & Group Bootstrap | All frames from the same video or near-duplicate photo sequence stay together in either train, val, or test—never split across them. Confidence intervals resample entire groups, measuring true generalization to new individuals and recordings. | All v1.0.0 splits come from 221,570 independent image/video groups. |
Box-Size NME vs. Interocular-Distance (% IOD) NME
For cross-species 68-point pose benchmarks, PrimateFace normalizes error by face box size (√(w × h)) because side-profile primate faces can have both eyes nearly superimposed, making eye-to-eye distance unreliable. For frontal 68→48 macaque landmark conversion (Fig. 5d–f), error is also reported as % IOD (percentage of outer-eye-corner distance).
Canonical v1.0.0 Test Split Summary¶
Model Checkpoint (v1.0.0) | Framework | Canonical Split | Headline Score |
|---|---|---|---|
primateface_rfdetr_m_v1.0.0.pth | RF-DETR | det_test (n = 23,897 images / 28,912 faces) | AP 0.670 / AP@0.50 0.961 / AP@0.75 0.774 |
primateface_vitpose_l_v1.0.0.pth | MMPose | pose_test (n = 15,814) | 0.58% median NME |
dlc3_rtmpose_m_v1.0.0.pt | DeepLabCut 3.0.2 | pose_test (n = 15,814) | 0.62% median NME |
primateface_rtmpose_m_v1.0.0.pth | MMPose | pose_test (n = 15,814) | 0.71% median NME |
primateface_hrnet_w18_v1.0.0.pth | MMPose | pose_test (n = 15,814) | 0.85% median NME |
lp2_resnet18_v1.0.0.ckpt | Lightning Pose 2.0 | pose_test (n = 15,814) | 0.85% median NME |
sleap_convnext_tiny_v1.0.0.ckpt | SLEAP-NN | pose_test (n = 15,814) | 1.09% median NME |
See Model Zoo for download sizes, speed vs. accuracy guidance, and licenses.
Verified evals/ CLI Reference¶
All evaluation scripts live in evals/ in the GitHub repository.
1. Per-Genus Evaluation & Summary Plots¶
Evaluate detection and 68-point landmark error stratified by primate genus and superfamily, then plot distributions and metric charts. Note that evals/eval_genera.py expects an MMDetection detector config and checkpoint (--det-config / --det-checkpoint, such as the legacy Cascade R-CNN comparator) alongside an MMPose pose config and checkpoint:
# Score MMDetection + MMPose models across genera (GPU recommended)
python evals/eval_genera.py \
--coco-json pose_test.json \
--images-dir path/to/images/ \
--label-csv genus_to_superfamily.csv \
--det-config path/to/det_config.py --det-checkpoint path/to/det.pth \
--pose-config path/to/pose_config.py --pose-checkpoint path/to/pose.pth \
--output-dir results/genera/
# Plot per-genus summary charts from the saved JSON (CPU)
python evals/visualize_eval_results.py \
--results results/genera/eval_results.json \
--label-csv genus_to_superfamily.csv \
--output results/plots/
# Plot genus & superfamily corpus counts (CPU)
python evals/plot_genus_distribution.py \
--count-csv genus_counts.csv \
--label-csv genus_to_superfamily.csv \
--output genus_distribution.svg
2. Off-the-Shelf Human Detector Baseline (SCRFD-10G)¶
Why not just run a standard human face detector on primates? On canonical det_test, the popular off-the-shelf human detector InsightFace SCRFD-10G recovers only 22.7% of non-human primate faces at confidence ≥ 0.50. Reproduce that superfamily-stratified score from saved predictions on CPU:
python evals/score_scrfd_canonical_test.py \
--preds-parquet scrfd_preds.parquet \
--gt-json det_test.json.gz \
--out-json scrfd_test_metrics.json
Expected output writes overall COCO AP/AP50/AP75 plus greedy-matched recall and precision per superfamily at confidence 0.30 and 0.50 to scrfd_test_metrics.json.
3. Qualitative Side-by-Side Comparison Grids¶
Generate visual comparison grids across detectors or landmark models (used for Figs. 3a and 4a):
# Detection comparison grid (image directory or COCO JSON)
python evals/compare_det_models.py --coco det_test.json --output results/det_grid/ --output-format png
# Pose comparison grid across videos or COCO JSON
python evals/compare_pose_models.py --coco pose_test.json --output pose_grid.png --num-items 3
4. Cross-Framework Landmark Evaluation (DLC, Lightning Pose, SLEAP)¶
Dedicated NME evaluators match each external pose framework's native checkpoint format (see the Pose Frameworks Guide for training recipes):
# DeepLabCut 3.0.2
python evals/dlc/evaluate_nme.py --model_dir path/to/dlc_model/ --test_json pose_test.json --output_dir results/dlc/
# Lightning Pose 2.0
python evals/lightning_pose/evaluate_lpose_nme.py \
--ckpt lp2_resnet18_v1.0.0.ckpt --coco-json pose_test.json.gz \
--image-dir path/to/images/ --out-json results/lp2_metrics.json
# Legacy SLEAP 1.x (TensorFlow) evaluator
python evals/sleap/evaluate_sleap_nme.py path/to/sleap_1x_model_dir/
SLEAP 1.x scripts vs. v1.0.0 sleap-nn checkpoint
The scripts in evals/sleap/*.py are legacy SLEAP 1.x (TensorFlow) helpers retained for older SLEAP model directories. The canonical v1.0.0 checkpoint (sleap_convnext_tiny_v1.0.0.ckpt) uses the modern PyTorch sleap-nn backend—see Pose Frameworks Guide for sleap-nn inference and evaluation.