Skip to content

68-Point Landmark Map & 68↔48 Conversion

PrimateFace tracks 68 standardized facial landmarks on every detected primate face — the same anatomical layout used across human face analysis (iBUG / dlib 68-point standard). If your lab already works with an older 48-point human–macaque or 55-point DeepLabCut MacaqueFace dataset, PrimateFace also ships a lightweight geometric converter that translates 68↔48 landmarks directly on a laptop CPU with no retraining and no GPU.

Cross-schema primate facial landmark conversion from 68-point COCO landmarks to 48-point schema Translating 68-point PrimateFace landmarks onto the shared 48-point overlap schema (PF-48) without retraining pose models.

Do I need a GPU?

No. Both reading 68-point landmarks and running the v1.0.0 Procrustes RBF 68→48 converter use pure NumPy on any laptop CPU (~1.3 milliseconds per face — about 750 faces per second on a single CPU core).

Part 1: Reading the 68-Point PrimateFace Map

Every Face object stores face.keypoints as a 68 × 3 table containing [x, y, confidence] for each landmark (0-indexed from 0 to 67). "Right" and "left" refer to the animal's anatomical right and left (on a frontal photo, the animal's right eye appears on the viewer's left).

Landmark Indices Count Anatomical Region Notes
0–16 17 Jaw / face contour Runs from right upper cheek (0) down to chin (8) and up to left cheek (16)
17–21 5 Right eyebrow Outer corner (17) to inner brow (21)
22–26 5 Left eyebrow Inner brow (22) to outer corner (26)
27–30 4 Nose bridge Top between eyes (27) down to nose tip (30)
31–35 5 Nose base / nostrils Right nostril wing (31) across subnasale (33) to left wing (35)
36–41 6 Right eye Outer corner (36), upper lid (37–38), inner corner (39), lower lid (40–41)
42–47 6 Left eye Inner corner (42), upper lid (43–44), outer corner (45), lower lid (46–47)
48–59 12 Outer mouth / lips Right corner (48), upper lip (49–53), left corner (54), lower lip (55–59)
60–67 8 Inner mouth opening Right inner corner (60), inner upper lip (62), inner lower lip (66)

Why are ears excluded?

Primate ears vary dramatically across clades — from small, close-set ears in great apes to tufted ears in marmosets and large, independently mobile pinnae in lemurs and bushbabies. Excluding ears keeps all 68 landmarks anatomically homologous across all 69 primate genera.

To slice out a specific anatomical region in Python, index directly into face.keypoints (or import named index lists from primateface.analysis.constants):

from primateface.analysis.constants import RIGHT_EYE, LEFT_EYE, INNER_MOUTH

# face.keypoints has shape (68, 3): [x, y, confidence]
right_eye_xy = face.keypoints[RIGHT_EYE, :2]    # shape (6, 2)
inner_mouth_xy = face.keypoints[INNER_MOUTH, :2]  # shape (8, 2)
print("Right eye points:", right_eye_xy.shape, "| Inner mouth:", inner_mouth_xy.shape)

Expected output:

Right eye points: (6, 2) | Inner mouth: (8, 2)

Understanding Visibility Flags

In natural footage, hands, branches, cage bars, or profile head turns often hide part of a primate's face. Rather than forcing annotators to guess invisible points, PrimateFace records a 4-state visibility flag per landmark during curation and maps it cleanly into standard COCO JSON (Common Objects in Context, the standard annotation file format for pose models):

PrimateFace Curation State COCO v Flag Plain-English Meaning Used in Training & Scoring?
visible v = 2 Landmark is clearly seen in the image Yes (trained and scored)
hidden v = 1 Landmark is blocked by an object or head turn (self-occluded) Excluded from visible-point NME
unsure v = 0 or 1 Annotator could not localize the point reliably Excluded from visible-point NME
out_of_frame v = 0 Point falls outside the cropped image border Excluded from visible-point NME

Because PrimateFace pose models are trained and benchmarked strictly on visible points, hidden far-side landmarks on side-profile faces never distort your error measurements.

Part 2: Converting 68↔48 Points (No Retraining, No GPU)

Many primatology labs already have years of behavioral annotations in the DeepLabCut MacaqueFace (55-point) or human–macaque 48-point scheme (PF-48, the 48 landmarks shared across the two face standards). Instead of relabeling your archive or retraining a new neural network, you can map 68-point PrimateFace outputs onto the 48-point layout instantly using the shipped Universal Procrustes RBF converter:

  • Artifact: primateface_68to48_procrustes_krr_v1.0.0.npz (2.6 MB, MIT License, pure NumPy — no PyTorch required).
  • Speed: ~1.3 ms per face on a standard laptop CPU.
  • How it works (in plain terms): First it rotates, scales, and centers each face onto a standard reference face (Procrustes alignment) so camera zoom and head tilt do not matter; then a smooth nonlinear regression (RBF kernel ridge regression) maps the aligned 68 points to the 48 target positions and transforms them back to original image pixels.
  • Accuracy: 2.86–2.88% of outer-eye-corner distance (IOD) — roughly 1.6 pixels on a 1080p video frame — evaluated under strict date-disjoint 5-fold cross-validation across all three shipped 68-point backbones (ViTPose-L, RTMPose-M, HRNetV2-W18). Reverse 48→68 conversion achieves 1.81% IOD.
Direction Input Backbones Tested Cross-Validated Error (% IOD) Typical Pixel Error (1080p) Runtime (CPU)
68 → 48 ViTPose-L, RTMPose-M, HRNetV2-W18 2.86–2.88% IOD ~1.6 px ~1.3 ms / face
48 → 68 Shared PF-48 overlap points 1.81% IOD ~1.0 px ~1.3 ms / face

Running the Converter

First download the .npz file with python demos/download_models.py ./models (see Models & Thresholds), then convert either a full COCO JSON file or NumPy arrays directly in Python:

python landmark-converter/convert_coco_68to48.py \
    --model-path ./models/primateface_68to48_procrustes_krr_v1.0.0.npz \
    --coco-json preds_68kpts.json \
    --image-dir ./images \
    --output-dir ./out_48kpts \
    --save-png

Expected output:

Converted 120 annotations (68->48) -> out_48kpts/annotations_48kpts.json (12 overlays saved)

import sys, primateface
sys.path.insert(0, "landmark-converter")
from procrustes_krr_converter import ProcrustesRBFConverter

pf = primateface.PrimateFace()
faces = pf.analyze("monkey.jpg")
pts_68 = faces[0].keypoints[:, :2]  # shape (68, 2)

conv = ProcrustesRBFConverter.load("./models/primateface_68to48_procrustes_krr_v1.0.0.npz")
pts_48 = conv.predict(pts_68)  # (68, 2) -> (48, 2), or batch (N, 68, 2) -> (N, 48, 2)
print(pts_48.shape)

Expected output:

(48, 2)

What geometric conversion can — and cannot — do

The converter translates correlated facial geometry (brows, eyelids, nose, mouth, and jaw contour). It cannot invent unmeasured signals that were never captured by the 68-point landmarks — for example, independent ear flattening/pinna movements or pupil saccades inside the eye.

Legacy PyTorch neural converter trainers (landmark-converter/train.py & apply_model.py)

For reproducibility with earlier neural baselines (simple_linear, mlp, mlp_attention, and gnn), landmark-converter/ retains train.py and apply_model.py for training and applying PyTorch keypoint converters on paired COCO JSON datasets (68_to_49, 49_to_68, or custom schemas). For new workflows, prefer the 2.6 MB NumPy-only ProcrustesRBFConverter above — it matches or beats the neural baselines with zero GPU overhead.

Next Steps