face-alignment
Detector 2D or 3D face landmarks from Python
What it is and what it does
face-alignment is a Python library that detects facial landmarks—specific points on a face like eyes, nose, and mouth corners—in both 2D and 3D coordinates. It wraps a state-of-the-art deep learning model (FAN) and runs on PyTorch, supporting multiple face detection backends (SFD, BlazeFace, YuNet, RetinaFace, SCRFD) with different speed-accuracy tradeoffs. You instantiate a FaceAlignment object with your chosen landmark type and face detector, then call get_landmarks() on images or directories.
The library is designed for computer vision pipelines that need precise facial geometry—facial expression analysis, face morphing, 3D face reconstruction, or face verification systems. It handles GPU/CPU device selection, batch processing, and optional torch.compile optimization. Runtime dependencies include torch, numpy, scipy, scikit-image, opencv-python, tqdm, numba, and packaging, all standard data-science and vision libraries.
Use it for:
- Extract facial landmarks from photos for 3D face reconstruction or morphing applications.
- Detect 2D face keypoints for facial expression recognition or emotion analysis pipelines.
- Batch process entire image directories to generate landmark datasets for model training.
- Integrate into face verification systems that need precise landmark alignment before comparison.
- Run inference on GPU-accelerated hardware for real-time facial analysis in production systems.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Detects 2D and 3D facial landmarks from images using deep learning, supporting multiple face detection backends and GPU acceleration via PyTorch.
Yes. The package is actively maintained, has low install friction, permissive BSD licensing, zero known vulnerabilities, and strong community adoption (7536 stars). It's the right choice if you need accurate 2D/3D facial landmark detection with flexible face detector options and GPU support. Install it if facial geometry extraction is core to your application.
Install
face-alignment on PyPI
pip
pip install face-alignmentuv
uv add face-alignmentpoetry
poetry add face-alignmentInstalling face-alignment
Before you install
Low friction install via pip with a pure-Python wheel. Active maintenance with recent commits and 7536 GitHub stars. Requires PyTorch (>=2.0) and eight runtime dependencies including torch, numpy, scipy, scikit-image, and opencv-python, all widely available.
License in practice
BSD permissive license allows commercial and private use with minimal restrictions, making it suitable for most projects.
Quickstart
pip install face-alignment
import face_alignment
fa = face_alignment.FaceAlignment(face_alignment.LandmarksType.TWO_D, flip_input=False)
preds = fa.get_landmarks(input_image)
Requires Python 3.9+, PyTorch >=2.0, and CUDA-enabled GPU recommended for performance; first run compiles the landmark network (~25s).
Verify before relying
- Whether pre-trained model weights are downloaded automatically on first use and their total size.
- Memory requirements for processing images on CPU versus GPU.
- Accuracy metrics or benchmark comparisons against other face alignment libraries.
Package facts
| License | BSD (permissive) |
| Python support | supports the current Python release (>=3) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 8 — torch, numpy, scipy, scikit-image, opencv-python, tqdm, numba, packaging |
| Maintenance | actively maintained — 130 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 191,129/month — #9,889 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: face_alignment-1.5.0-py3-none-any.whl
Tags
More Artificial Intelligence packages
LiteLLM provides a unified Python interface to…
permissive · top 100 on PyPI
huggingface-hubClient library and CLI tool for downloading,…
permissive · top 100 on PyPI
langchainLangChain provides a framework for building…
permissive · top 1,000 on PyPI
hf-xethf-xet provides chunk-based deduplication and…
permissive · top 1,000 on PyPI
tokenizersTokenizers converts raw text into token…
permissive · top 1,000 on PyPI
transformersTransformers provides a unified framework for…
permissive · top 1,000 on PyPI
facexlibFacexlib provides a collection of PyTorch-based…
permissive · top 5,000 on PyPI
mtcnnDetects faces and facial landmarks (eyes, nose,…
permissive · top 5,000 on PyPI
retina-faceDetects faces in images and extracts facial…
permissive · top 15,000 on PyPI
face-recognitionDetects, locates, and identifies faces in…
permissive · top 15,000 on PyPI
controlnet-auxProvides computer vision annotation and…
permissive · top 15,000 on PyPI
retinaface-pyDetects and localizes faces in images using a…
permissive · top 15,000 on PyPI
smplxLoads and manipulates SMPL-X, a unified 3D body…
unclear · top 15,000 on PyPI
insightfaceInsightFace is a Python library for face…
unclear · top 5,000 on PyPI
deepfaceDeepFace performs face recognition,…
permissive · top 15,000 on PyPI
face_recognition_modelsProvides pre-trained deep learning models for…
permissive · top 15,000 on PyPI