← all repositories
1adrianb/face-alignment

Landmark detection in 2D or 3D with your pick of five detectors

A PyTorch face-alignment library that outputs 2D or 3D landmarks and lets you swap in anything from SFD to YuNet.

7.5k stars Python Computer VisionML Frameworks
face-alignment
Not currently ranked — collecting fresh signals.
star history

What it does Detects facial landmarks in both 2D and 3D coordinates using the FAN network, wrapped in a PyTorch library that ingests single images or entire directories. It is essentially an inference-focused toolkit: the README presents the method as a black box and defers to the original paper for architectural details.

The interesting bit The library decouples landmark prediction from face detection, letting you swap in five different detector backends—from the accurate-but-slower SFD to the lightweight YuNet—or bypass detection entirely by loading pre-computed bounding boxes from .npy, .t7, or .pth files. It also compiles the landmark network with torch.compile by default, so after an initial ~25-second warm-up, inference is faster; pass compile=False if you need instant startup.

Key highlights

  • Outputs facial landmarks in both 2D and 3D coordinates from the same alignment network.
  • Supports five active face-detector backends with published CPU and MPS latency numbers measured on an Apple M2.
  • Can process entire directories in one call, or skip detection entirely using the face_detector='folder' mode for ground-truth evaluations.
  • Uses torch.compile by default with on-disk caching, and allows opting out for immediate use.
  • Runs on CUDA, Apple MPS, or CPU, with optional bfloat16 inference and a configurable max_batch_size for low-memory GPUs.

Caveats

  • The README recommends the older Lua version for numerical evaluations because it uses paper-identical models; this PyTorch port may differ slightly.
  • YuNet and SCRFD are CPU-only, and SCRFD requires the optional onnxruntime dependency.
  • The project is presented as a black-box inference tool; do not expect training code or deep methodological documentation in the repository itself.

Verdict Worth a look if you need drop-in 2D or 3D face landmarks in PyTorch with modern hardware support and detector flexibility. Skip it if you need the exact paper models for numerical evaluation—the README still points to the Lua version for that.

Frequently asked

What is 1adrianb/face-alignment?
A PyTorch face-alignment library that outputs 2D or 3D landmarks and lets you swap in anything from SFD to YuNet.
Is face-alignment open source?
Yes — 1adrianb/face-alignment is open source, released under the BSD-3-Clause license.
What language is face-alignment written in?
1adrianb/face-alignment is primarily written in Python.
How popular is face-alignment?
1adrianb/face-alignment has 7.5k stars on GitHub.
Where can I find face-alignment?
1adrianb/face-alignment is on GitHub at https://github.com/1adrianb/face-alignment.

heatdrop uses Google Analytics to see which pages get read — nothing else. Your call. How we handle data.