DeepFace: Face recognition and facial attribute analysis
Python library wrapping multiple face recognition deep learning models.
Learn more about deepface
DeepFace is a Python library that performs face recognition and facial attribute analysis through deep learning models. It implements a modular pipeline consisting of face detection, alignment, normalization, representation, and verification stages. The library supports multiple backbone architectures including VGG-Face, FaceNet, OpenFace, DeepFace, DeepID, ArcFace, Dlib, SFace, GhostFaceNet, and Buffalo_L, allowing users to select different models for different accuracy and performance trade-offs. Common applications include identity verification, facial expression recognition, demographic prediction, and face clustering tasks.
Swappable Recognition Models
Ten interchangeable face recognition architectures (VGG-Face, FaceNet, OpenFace, DeepFace, DeepID, ArcFace, Dlib, SFace, GhostFaceNet, Buffalo_L) accessible through a unified API. Switch models with a single parameter to optimize for accuracy, inference speed, or memory footprint without code refactoring.
Unified Attribute Analysis
Single interface extracts face recognition embeddings and facial attributes (age, gender, emotion, race) simultaneously. Eliminates integration overhead of combining multiple specialized models and preprocessing pipelines.
Complete Pipeline Implementation
Handles detection, alignment, normalization, representation, and verification stages automatically with sensible defaults. No manual orchestration of preprocessing steps or model coordination required.
from deepface import DeepFace
# Verify if two images contain the same person
result = DeepFace.verify(
img1_path="person1.jpg",
img2_path="person2.jpg"
)
print(f"Same person: {result['verified']}")
print(f"Distance: {result['distance']}")Patches FastMtCnn detection bug and reverts Flask/Werkzeug dependency changes; adds confidence metric for fbdeepface model.
- –Update if using FastMtCnn detector to fix detection errors introduced in prior release.
- –Note Flask and Werkzeug dependencies restored to earlier constraints; check compatibility with your environment.
Performance and usability release adding batching to represent/analyze, YOLOv11 detector, Buffalo_L model, and Angular distance metric.
- –Enable GPU batching in `.represent()` and `.analyze()` to speed up bulk embedding generation and attribute prediction.
- –Add YOLOv11 face detector, Buffalo_L recognition model, and Angular distance metric; update thresholds and weight loading accordingly.
Refactors internal model structure and detection module; DetectorWrapper removed, models reorganized into dedicated folders.
- –Update imports if you reference DetectorWrapper directly; detection now handled within the detection module.
- –Use max_faces argument in represent to limit face processing; extract_faces now supports RGB, BGR, or grayscale output.
Related Repositories
Discover similar tools and frameworks used by developers
stablediffusion
Text-to-image diffusion in compressed latent space.
Kimi-K2
Trillion-parameter MoE model with Muon-optimized training.
video2x
Video2X enhances video quality using machine learning algorithms for upscaling, frame interpolation, and restoration with multiple backend support.
mlx
Lazy-evaluated NumPy-like arrays optimized for Apple silicon.
optuna
Define-by-run Python framework for automated hyperparameter tuning.