skillfed

face-alignment

Detector 2D or 3D face landmarks from Python

face-alignment v1.5.0 191.1K downloads/30d#9,889 on PyPI7,536
Permissive license BSD Active released

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-alignment

uv

uv add face-alignment

poetry

poetry add face-alignment

Installing 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

Development Status :: 5 - Production/StableLicense :: OSI Approved :: BSD LicenseNatural Language :: EnglishOperating System :: OS IndependentProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.9

Tags

facial landmark detectionface alignment python2d 3d face landmarksfacial keypoint detectionface detection landmarksdeep learning face analysisfacial geometry extraction
computer-visiondeep-learningfacial-analysis

More Artificial Intelligence packages