deepface
A Lightweight Face Recognition and Facial Attribute Analysis (Age, Gender, Emotion and Race) Library for Python
What is deepface?
A Lightweight Face Recognition and Facial Attribute Analysis (Age, Gender, Emotion and Race) Library for Python
Overview of deepface
What it is
DeepFace is a lightweight face recognition and facial attribute analysis library for Python. It wraps multiple state-of-the-art models: VGG-Face, FaceNet, OpenFace, DeepFace, DeepID, ArcFace, Dlib, SFace, GhostFaceNet, and Buffalo_L. The library handles five common stages of a face recognition pipeline: detect, align, normalize, represent, and verify. It can run on ONNX Runtime (default), TensorFlow, or PyTorch.
Key features
- Face verification: determines whether two facial images belong to the same person.
- Face recognition: searches for the identity of an input image within a specified folder, S3, or FTP.
- Database-backed face recognition: supports backends including postgres, mongo, neo4j, pgvector, pinecone, milvus, qdrant, weaviate, sqlite, oracle, mssql, db2, redis, cassandra, and mysql.
- Facial attribute analysis: predicts age, gender, facial expression (angry, fear, neutral, sad, disgust, happy, surprise), and race (asian, white, middle eastern, indian, latino, black).
- Real-time analysis: accesses webcam and applies face recognition and attribute analysis.
- Embedding extraction: returns multi-dimensional vectors representing facial images.
- Multiple face detection and alignment backends: OpenCV, Ssd, Dlib, MtCnn, RetinaFace, MediaPipe, Yolo, YuNet, CenterFace.
Use cases
- Identity verification for security or access control.
- Searching for a person in a database of face images.
- Analyzing demographic attributes (age, gender, emotion, race) from photos or video streams.
- Building custom face recognition systems with database-backed operations.
- Real-time face analysis in live video feeds.
Getting started
shell # Install deepface from PyPI (default backend: ONNX Runtime) $ pip install deepface # Or install with TensorFlow backend # $ pip install 'deepface[tensorflow]' # Or install with PyTorch backend # $ pip install 'deepface[pytorch]' After installation, import and use: python from deepface import DeepFace
License and pricing
The license is MIT. The library is open source and free to use.
Based on the project's public README and repository metadata.