Skip to content

Repository files navigation

PrimateFace Logo

PrimateFace: A machine learning resource for automated primate face analysis

bioRxiv    Project Website    Documentation    Hugging Face Dataset    Hugging Face Models

PrimateFace v1.0.0 is an open machine learning resource for automated primate face analysis—pairing a curated dataset of 240,241 real images and 291,231 verified faces across 69 primate genera (all 6 superfamilies; 34,623 openly licensed Tier-1 images + 205,618 Tier-2 links/identifiers; plus 36,360 training-only synthetic faces) with permissively licensed pretrained models (MIT / Apache-2.0 / BSD-3-Clause) and tutorials (Parodi et al., 2025). A CUDA GPU is recommended for local inference; CPU and Google Colab are supported (tutorials).

PrimateFace demos

Quick Start

import primateface
pf = primateface.PrimateFace()
faces = pf.analyze("demos/ateles_000003.jpeg")

(Full 68-point landmark inference via PrimateFace() requires MMPose — see demos/README.md or launch any zero-setup Google Colab notebook. Detection, 69-genus classification, and 68 ↔ 48 conversion run without MMPose.)

  • Browse the Hugging Face Dataset for annotations, provenance metadata, and Tier-1 images.
  • Run the 8 self-contained tutorial notebooks locally or in Google Colab.
  • Download pretrained v1.0.0 weights locally with python demos/download_models.py (SHA-256 verified).

Repository Structure

configs/release_v1.0.0/  # MMPose v1.0.0 configs (ViTPose-L, RTMPose-M, HRNetV2-W18)
dataset/                 # Dataset overview, two-tier access notes, and citation
demos/                   # CLI demos, model downloader, genus/attribute scripts, and 8 notebooks
dinov2/                  # DINOv2 feature extraction and visualization
docs/                    # Documentation source
evals/                   # Model evaluation across frameworks & datasets
gui/                     # Pseudo-labeling CLI and annotation tools
landmark-converter/      # Universal Procrustes RBF & neural keypoint converters (68 <-> 48 kpts)
primateface/             # Core library (Core Python API & CLI)
├── analysis/            #   Facial analysis (kinematics, symmetry, head pose, quality)
├── io.py                #   Export to CSV, COCO, DLC, SLEAP, NWB
└── cli.py               #   CLI: primateface analyze, primateface models
tests/                   # Unit tests

Shipped v1.0.0 Model Stack (Zero AGPL Dependencies)

  • Face Detection: RF-DETR-M (Apache-2.0, AP = 0.670 / AP@0.50 = 0.961; legacy Cascade R-CNN retained as optional comparator)
  • 68-Point Facial Landmarks (MMPose, Apache-2.0): ViTPose-L (0.58% median NME), RTMPose-M (0.71%), HRNetV2-W18 (0.85%)
  • Companion Cross-Platform 68-Point Weights: DeepLabCut 3.0.2 RTMPose-M (0.62%, Apache-2.0 weights / LGPL-3.0 DLC), Lightning Pose 2.0 ResNet-18 (0.85%, MIT), SLEAP-NN ConvNeXt-Tiny (1.09%, BSD-3-Clause)
  • Genus & Facial Attributes: ConvNeXt-Small 69-genus classifier (BSD-3-Clause, 96.0% Top-1 / 97.6% indep-ID) plus training/inference scripts for six observable facial-attribute heads (demos/train_attribute_heads.py)
  • Landmark Conversion: Universal Procrustes RBF 68→48 converter (MIT, NumPy-only, 2.6 MB, ~1.3 ms/face on CPU)

Installation

We recommend uv with Python 3.10+ (>=3.9) and PyTorch matching your CUDA version (pytorch.org):

uv venv --python 3.10
source .venv/bin/activate  # Windows: .venv\Scripts\activate

# Install PyTorch (CUDA 12.4 example; use .../whl/cpu for CPU-only)
uv pip install torch torchvision --index-url https://download.pytorch.org/whl/cu124

# Install PrimateFace from a local clone (recommended: core + RF-DETR-M + DINOv2 + GUI + dev)
uv pip install -e ".[rfdetr,dinov2,gui,dev]"

# Or install directly from GitHub without cloning:
# uv pip install "primateface[rfdetr] @ git+https://github.com/KordingLab/PrimateFace.git"

Individual optional extras: rfdetr (Apache-2.0 RF-DETR-M detector), dinov2 (DINOv2 feature extraction), gui (pseudo-labeling tools), dev (pytest & tooling).

Optional Pose & Tracking Frameworks

Tutorials & Links

Project Website · Documentation · Tutorials · HF Dataset · HF Models · GitHub

Tutorial Description
quickstart Start here — 3-line API, 68 landmarks, 3D pose, HRNet vs RTMPose, CSV/COCO/DLC/SLEAP/NWB export
genus_classification Detect faces (RF-DETR-M) & classify 69 genera (ConvNeXt-Small) with selective abstention (zero MMPose)
landmark_conversion_68_48 Pure-NumPy 68 ↔ 48 Procrustes RBF converter (~1 ms/face), 104-landmark table & kinematics (CPU only)
batch_video_and_export Batch photo/video tracking with MedianSavgolSmoother, quality filtering & explicit blank gaps
lemur_video_timestamping Pure RF-DETR-M video detection, IoU tracking, presence timelines & BORIS v7.0 export (zero MMPose)
howler_vocal_motor_coupling Wild Alouatta mouth-aperture kinematics vs 150–1,200 Hz howl envelope + circular-shift null & controls
macaque_face_recognition Temporally disjoint individual recognition: raw vs 2-pt Umeyama eye alignment (ArcFace, MegaDescriptor, DINOv2)
dyadic_facial_interaction Dyadic proximity, rectified mutual facing & lagged mouth-aperture turn-taking + circular-shift null (CPU only)

Citation

@article{parodi2025primateface,
  title={PrimateFace: A Machine Learning Resource for Automated Face Analysis in Human and Non-human Primates},
  author={Parodi, Felipe and Matelsky, Jordan K. and Lamacchia, Alessandro P. and Segado, Melanie and Jiang, Yaoguang and Regla-Vargas, Alejandra and Sofi, Liala and Kimock, Clare and Waller, Bridget M. and Platt, Michael L. and Kording, Konrad P.},
  journal={bioRxiv},
  year={2025},
  doi={10.1101/2025.08.12.669927}
}

Contact & Contributors

Questions or collaborations: primateface@gmail.com · fparodi@upenn.edu

Contributors: Felipe Parodi* (UPenn), Jordan K. Matelsky (UPenn; JHU APL), Alessandro P. Lamacchia (UPenn), Melanie Segado (UPenn), Yaoguang Jiang (UPenn), Alejandra Regla-Vargas (UPenn), Liala Sofi (UPenn), Clare Kimock (Nottingham Trent Univ.), Bridget M. Waller (Nottingham Trent Univ.), Michael L. Platt* (UPenn), Konrad P. Kording* (UPenn; CIFAR).

Maintained by the Kording and Platt labs at the University of Pennsylvania. Released under the MIT License.

Acknowledgements

Category Framework / Resource Link
Face Analysis InsightFace github.com/deepinsight/insightface
Comp. Ethology DeepLabCut github.com/DeepLabCut/DeepLabCut
Lightning Pose github.com/paninski-lab/lightning-pose
SLEAP github.com/talmolab/sleap
General ML / CV RF-DETR github.com/roboflow/rf-detr
MMDetection github.com/open-mmlab/mmdetection
MMPose github.com/open-mmlab/mmpose
DINOv2 github.com/facebookresearch/dinov2
Hugging Face huggingface.co

Releases

Packages

Contributors

Languages