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']}")Adds digital signatures for pickle security, pgvector and Pinecone database backends, and dynamic inventory management.
- –Digital signatures for pickle creation and loading
- –pgvector backend added
- –Raise error when attempting signed datastore without credentials
- –Pinecone added as backend database
- –Dynamic database inventory management
Returns raw Python types for landmarks, adds mypy type checking, batch face extraction, and custom error handling.
- –Return raw Python types for landmarks
- –mypy type checking initialized
- –Batch extract faces
- –Custom error types
- –Install dependencies once
Moves configurations to a separate folder, adds YOLO 12 models, and introduces output normalization for face representations.
- –Store configurations in separate folder
- –Replace training.Model with Model in ArcFace
- –Expose AVAILABLE_MODELS from build_model
- –YOLO 12 models added with improved eye detection
- –Output normalization added to represent
See how people are using DeepFace
Related Repositories
Discover similar tools and frameworks used by developers
Wan2.1
Diffusion transformer models for text and image-to-video generation.
Unsloth
Memory-efficient Python library for accelerated LLM training.
Ray
Unified framework for scaling AI and Python applications from laptops to clusters with distributed runtime.
ByteTrack
Multi-object tracker associating low-confidence detections across frames.
CUTLASS
CUDA C++ templates and Python DSLs for high-performance matrix multiplication on GPUs.