Occlusion-Aware 478-Point 2D Face Landmarks

Author: Rudra Chauhan. Code and training: occlusion-aware-face-landmarks. Framework: PyTorch. Release date: 2026-11-28.

This is a small research checkpoint for 478 projected 2D landmark means and positional uncertainty from RGB pixels. It does not generate hidden pixels, reconstruct 3D anatomy, recognize identity or make clinical assessments. The image CNNs are trained from random initialization; full-image MediaPipe predictions supply the teaching labels. No pretrained image backbone or MediaPipe call is used for image-only inference.

Checkpoints

File Purpose Compatibility
rotation_detector.pt Latest 256px image detector; 3.13 MB Own pixel localizer + crop landmarker, covariance and calibration
detector2d.pt Previous 128px detector; 2.62 MB Legacy baseline / legacy completion inputs
completion2d.pt Separately trained legacy completion component; 131 KB Not retrained for the latest detector
pipeline2d.pt Previous detector + completion bundle; 2.75 MB Runs the original separate pipeline end-to-end

Do not attach the legacy completion directly to the upgraded image detector. New source-grouped OOF predictions and separate completion retraining are required. Files are custom PyTorch state-dictionary checkpoints, not Transformers AutoModel checkpoints. Use the repository loader, which calls torch.load(..., weights_only=True).

Use

git clone https://github.com/TOAORUDRA-01/occlusion-aware-face-landmarks.git
cd occlusion-aware-face-landmarks
python -m pip install -e .
python scripts/download_weights.py
python -m face_lab.rotation_detector --model models/rotation256 --image your_photo.jpg --output prediction.npz
from huggingface_hub import snapshot_download
from PIL import Image, ImageOps
from face_lab.rotation_detector import predict_image

folder = snapshot_download('TOAORUDRA1/occlusion-aware-face-landmarks', allow_patterns=['rotation_detector.pt'])
photo = ImageOps.exif_transpose(Image.open('your_photo.jpg')).convert('RGB')
result = predict_image(folder, photo)
print(result['mean'].shape)       # (478, 2), original oriented-image pixels
print(result['covariance'].shape) # (478, 2, 2)

Only pixels and weights enter ordinary inference. No reference landmarks or true visibility mask is supplied. Process only permitted photographs. An independently supplied target box is optional in the Python API; calibration coverage for that mode is unestablished.

Architecture and training

The localizer predicts center, square size and in-plane roll from pixels. A uniformly resampled 256px crop enters an own CNN with a train-only PCA decoder, two image-feature refinement passes, synthetic visibility logits and per-axis sigma. Crop covariance is rotated back into the image frame.

Training uses 1,290 LaPa photos, 18 localizer epochs and 28 landmark epochs on a CPU Colab runtime. Validation has 75 selection and 75 calibration photos, with 150 test photos. Structured synthetic masking and ±55° training roll augmentation are used; reviewed turned/profile training photos receive increased sampling weight. Targets are MediaPipe estimates, including potentially unreliable hidden positions.

The current training data is not publicly redistributed. Its source-photo/hash grouping is not verified identity-disjoint. The old completion was trained separately on the previous 1,000-photo training cohort with OOF detector predictions. See code for its own protocol; do not transfer detector results to completion.

Evaluation: development benchmark only

Both image detectors were evaluated on the same 4,200 clean/masked/rotated views from 150 photos after checkpoint selection and calibration were frozen.

Detector All-point NME Visible NME Hidden NME
Previous detector 56.373% 56.976% 52.680%
Rotation-aware detector 29.082% 28.652% 28.914%

NME is Euclidean error divided by reference eye-center distance, macro-averaged per photo. It is not percentage accuracy. Paired hidden-error improvement is 23.766 percentage points; exploratory photo-cluster 95% interval [22.031, 25.504]. The test cohort was used in earlier development; these are MediaPipe teacher-agreement scores, not independent anatomical or external-dataset validation. Source photos/identities are not established independent.

An explicitly privileged reference-crop diagnostic obtains 14.087% hidden NME. It uses reference coordinates and is not deployed performance. Only one reviewed profile test photo is available; broad profile performance is unvalidated. At +60° roll, hidden NME remains 81.135%, so extreme rotation handling is not solved.

Six rotation tests and fresh-process RGB-only inference passed in the recorded run. Published GitHub CI may run additional tests; consult its current status separately.

Uncertainty and limitations

Sigma is a predicted positional spread conditional on the crop, not a guarantee of error. Calibration uses photo-level worst scores over nine synthetic 0/±30° views. Coverage on the changed ±35°/±60° test conditions is empirical; there is no transferred nominal 90% guarantee. Synthetic visibility is not verified natural/self-occlusion visibility.

The model expects one main face and does not reliably reject no-face images or select a target in multi-face scenes. Arbitrary partial crops, blur, small faces, large yaw and real occlusion require independent evaluation. Hidden geometry is a plausible estimate, not recovery of actual hidden anatomy. No demographic or identity-disjoint performance audit has been completed. Do not use this prototype for decisions about people, clinical measurements or biometric identification.

Data rights and permitted use

Noncommercial research/personal experimentation only. LaPa's official README restricts dataset use to noncommercial purposes. This weight release does not grant commercial rights to that dataset, photographs, MediaPipe assets or any underlying rights. No dataset images or per-person landmarks are included. The source repository's Apache-2.0 code notice must not be treated as blanket commercial permission for the dataset. See LICENSE-model.txt and THIRD_PARTY_NOTICES.md.

Citation: Yinglu Liu et al., “A New Dataset and Boundary-Attention Semantic Segmentation for Face Parsing,” AAAI 2020, pp. 11637–11644.

Downloads last month
-
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support