Models & Thresholds¶
PrimateFace v1.0.0 ships nine pretrained models covering four tasks: finding primate faces in images or video, placing 68 facial landmarks, sorting faces into 69 primate genera, and translating landmarks between 68-point and 48-point schemas. Every model is permissively licensed (MIT / Apache-2.0 / BSD-3-Clause — safe for academic and commercial projects; zero AGPL).
Do I need a GPU?
- Yes, for long videos or
ViTPose-L: A single consumer GPU (4–8 GB VRAM, i.e., GPU memory) or a free Google Colab T4 GPU processes video at hundreds to thousands of frames per second. - No, for small photo sets or compact models:
RF-DETR-M+HRNetV2-W18, the genus classifier, and the68→48landmark converter all run on a standard laptop CPU (roughly 0.2–1 second per image for detection + landmarks; ~1.3 ms per face for conversion).
Which Model Should I Choose?¶
Pick the combination that matches your data and hardware:
- Finding faces (Detection) — use
RF-DETR-M(default): Apache-2.0, ~137 MB (131 MiB binary), AP@0.50 = 0.961 and AP = 0.670. In plain terms: AP@0.50 measures how reliably the model draws a box covering at least half of each true face (0.961 is ~96% accuracy balancing missed faces and false alarms), while AP averages stricter overlap thresholds up to 95% to test how tightly the box hugs the face. - Placing 68 facial landmarks — pick one of three MMPose models:
ViTPose-L(best accuracy): 0.58% median NME (~1.2 pixels of error on a 200-pixel-wide face), 1.23 GB, needs ~4 GB GPU memory (runs on free Google Colab T4). Choose this for fine-grained morphometrics or expression kinematics.RTMPose-M(fastest for long videos): 0.71% median NME, 4,066 FPS on GPU, 62 MB. Choose this when scanning hours of behavioral video.HRNetV2-W18(compact default): 0.85% median NME, 878 FPS on GPU, 41 MB. Small download and gentle on laptop CPUs. In plain terms: NME (Normalized Mean Error) is the average landmark placement error expressed as a percentage of face size — lower is better, and under 1% means sub-2-pixel accuracy on a typical 200-pixel face crop.- Already using DeepLabCut, Lightning Pose, or SLEAP? Use our drop-in companion 68-point checkpoints (
dlc3_rtmpose_m_v1.0.0.ptat 0.62% NME,lp2_resnet18_v1.0.0.ckptat 0.85% NME, orsleap_convnext_tiny_v1.0.0.ckptat 1.09% NME). See Framework Integration for setup commands.
Complete v1.0.0 Model Zoo¶
All benchmarks below come from the canonical group-disjoint 80/10/10 held-out test splits (80% train / 10% validation / 10% test with no video or photo burst split across them) (det_test.json.gz, n = 23,897 images / 28,912 faces; pose_test.json.gz, n = 15,814 faces; genus split, n = 11,149 faces). See Evaluation Benchmarks for clade-by-clade breakdowns.
| Checkpoint Filename | Task | Framework | Canonical Metric | Size | License |
|---|---|---|---|---|---|
primateface_rfdetr_m_v1.0.0.pth | Face detection | RF-DETR | AP 0.670 / AP@0.50 0.961 | ~137 MB (131 MiB) | Apache-2.0 |
primateface_vitpose_l_v1.0.0.pth | 68-pt landmarks | MMPose | 0.58% median NME (584 FPS) | 1.23 GB | Apache-2.0 |
dlc3_rtmpose_m_v1.0.0.pt | 68-pt landmarks | DeepLabCut 3.0.2 | 0.62% median NME | 62 MB | Apache-2.0 weights / LGPL-3.0 DLC |
primateface_rtmpose_m_v1.0.0.pth | 68-pt landmarks | MMPose | 0.71% median NME (4,066 FPS) | 62 MB | Apache-2.0 |
primateface_hrnet_w18_v1.0.0.pth | 68-pt landmarks | MMPose | 0.85% median NME (878 FPS) | 41 MB | Apache-2.0 |
lp2_resnet18_v1.0.0.ckpt | 68-pt landmarks | Lightning Pose 2.0 | 0.85% median NME | 45 MB | MIT |
sleap_convnext_tiny_v1.0.0.ckpt | 68-pt landmarks | SLEAP-NN | 1.09% median NME | 350 MB | BSD-3-Clause |
primateface_genus_convnext_s_v1.0.0.pth | 69-genus ID | PyTorch / torchvision | 96.0% Top-1 / 97.6% indep-ID (independently verified species labels) | 198 MB | BSD-3-Clause |
primateface_68to48_procrustes_krr_v1.0.0.npz | 68→48 conversion | NumPy-only | 2.86–2.88% IOD (eye-to-eye distance; ~1.3 ms CPU) | 2.6 MB | MIT |
Choosing a Detection Confidence Threshold (det_threshold)¶
Every time RF-DETR-M spots a potential face, it assigns a confidence score from 0.0 to 1.0. The det_threshold setting tells PrimateFace how sure the detector must be before keeping a box.
For camera traps, forest transects, or continuous enclosure recordings where many frames contain empty background, other wildlife, or monkeys facing away, raising det_threshold prevents false alarms (FPR = false positive rate, the share of face-absent frames that wrongly trigger a detection):
det_threshold | Best For | Non-Primate Wildlife FPR (LILA BC, n = 600) | Faceless Primate Body FPR (n = 440) |
|---|---|---|---|
0.50 (default) | Curated primate photos & close-up lab video | 1.00% (6 / 600) | 19.55% (86 / 440) |
0.70 | Camera traps & noisy field video | 0.00% (0 / 600) | 1.14% (5 / 440) |
0.75 | Strict automated pipelines (zero false alarms) | 0.00% (0 / 600) | 0.00% (0 / 440) |
import primateface
# Strict threshold for camera traps or continuous field video
pf = primateface.PrimateFace(pose_model="vitpose", det_threshold=0.70)
faces = pf.analyze("camera_trap_frame.jpg")
# Or override the threshold for a single call
strict_faces = pf.analyze("camera_trap_frame.jpg", det_threshold=0.75)
print(f"Kept {len(strict_faces)} high-confidence face(s)")
Watch out for backs of heads at 0.50
At the default 0.50 threshold, RF-DETR-M occasionally fires on the back of a primate's head or a furry torso when the face is turned away. Raising det_threshold to 0.70–0.75 eliminates virtually all of those false boxes while keeping clear primate faces.
Downloading & Verifying Models¶
You can either let the Python API fetch models on first use or pre-download them into a local folder (handy for offline field stations or HPC [university computing cluster] nodes).
import primateface
# Automatically downloads RF-DETR-M + chosen pose model from Hugging Face
# and verifies SHA-256 checksums before loading
pf = primateface.PrimateFace(
det_model="rfdetr", # default: RF-DETR-M
pose_model="rtmpose", # "hrnet" (default), "rtmpose", or "vitpose"
model_dir="./models", # optional local cache folder
)
Expected output on first run:
# Default compact stack: RF-DETR-M, HRNetV2-W18, RTMPose-M,
# ConvNeXt-Small genus classifier, and Procrustes RBF 68->48 converter
python demos/download_models.py ./models
# Add ViTPose-L (1.23 GB) and DeepLabCut / Lightning Pose / SLEAP weights
python demos/download_models.py ./models --include-vitpose --include-cross-platform
# Optional: include the legacy v0.1.0 Cascade R-CNN comparator
python demos/download_models.py ./models --include-legacy
Expected output (note: the script reports binary MiB, so ~137 MB decimal prints as 131.0 MB):
Technical details: SHA-256 verification & model hosting
Both PrimateFace(...) and demos/download_models.py automatically check each downloaded checkpoint against its pinned SHA-256 digest in primateface/_model_registry.py. You can also verify a local copy of the Hugging Face release manually against SHA256SUMS.txt:
- Hugging Face Model Hub: fparodi/primateface-models
- GitHub Repository: KordingLab/PrimateFace
- Inspect registered models from the CLI:
primateface models list
Next Steps¶
- Ready to run your first detection? Follow the Quickstart.
- Want to sort photo archives by genus or facial expression? Continue to Genus & Facial Attributes.
- Using DeepLabCut, Lightning Pose, or SLEAP? See Framework Integration.