--- id: face-alignment version: "1.5.0" license: BSD license_treatment: permissive maintenance: active --- # face-alignment — Detector 2D or 3D face landmarks from Python License: permissive · Maintenance: active · Downloads: 191.1K/mo ## 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 above — 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 pip install face-alignment uv add face-alignment 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_current - Install friction: low - Maintenance: active - Downloads: 191.1K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags facial landmark detection, face alignment python, 2d 3d face landmarks, facial keypoint detection, face detection landmarks, deep learning face analysis, facial geometry extraction, computer-vision, deep-learning, facial-analysis [View on SkillFed](https://skillfed.io/packages/face-alignment) · [View on PyPI](https://pypi.org/project/face-alignment/)