
deepface
Python library for face verification, face search, and estimating age, gender, emotion and race from photos.
- Stars
- 23.6k
- Forks
- 3.2k
- Licence
- MIT
- Language
- Python
- Last update
- 6 days ago
- Type
- Library
What it is
DeepFace is a Python library that compares faces in images to tell whether two photos show the same person, searches a folder or database for a matching face, and estimates attributes such as age, gender, emotion and race. It wraps several existing face recognition models behind a few simple function calls, so you do not need to build the detection and comparison pipeline yourself. It is used by developers who want face features without writing the underlying deep learning code.
- Check whether two photos show the same person with DeepFace.verify
- Search a folder of images for a face that matches an input image with DeepFace.find
- Register face embeddings in a supported database and query them with identify or search
- Estimate age, gender, emotion or race from a face image using the analysis function
Great for
- Python developers prototyping face verification or face search
- Researchers comparing several face recognition models through one interface
- Teams that want to store face embeddings in an existing database such as Postgres or Redis
- Hobbyists who want to run face analysis on their own photos locally
Not ideal for
- Anyone needing a legally vetted biometric system: the README does not address compliance, consent or accuracy guarantees for production identification
- People who do not write Python, since the README only documents Python usage
- Users with limited disk space who want the TensorFlow or PyTorch backends, which the README says add one to several GB
How to get it
- 1
Install with a package manager
You'll need: Python (version not stated in the README excerpt) · pip
Install from PyPI (ONNX Runtime backend by default)
pip install deepfaceInstall with TensorFlow backend
pip install "deepface[tensorflow]"Install with PyTorch backend
pip install "deepface[pytorch]" - 2
Run it
- Install the package with pip install deepface
- Open Python and run: from deepface import DeepFace
- Call DeepFace.verify(img1_path = "img1.jpg", img2_path = "img2.jpg") on two local images
- Read the returned dictionary and check the verified key (True means same person)
- 3
Get the most out of it
- Set the DEEPFACE_BACKEND_ENGINE environment variable to choose onnx, tensorflow or pytorch
- Use DeepFace.find to search a whole folder for a matching face
- Register embeddings with DeepFace.register and query with identify or search for database-backed lookup
- Install from source with pip install -e . to get features the README says may not yet be in the PyPI release
Downloads
Strengths
- Wraps multiple recognition models (for example VGG-Face, FaceNet, ArcFace) behind a consistent interface
- Reduces the pipeline to single function calls, per the README
- Supports many database backends for scalable lookup, and is MIT licensed
Trade-offs
- The README's accuracy comparison to humans is a self-reported benchmark that it does not independently verify here; results depend on the model and images used
- Default ONNX install is lighter than TensorFlow or PyTorch, but the backend choice still affects setup size and behavior
- Face analysis of emotion, age, race and gender is inherently uncertain and the README gives no caveats about bias or error rates
How it compares
| Project | Stars | Type | Level | Updated | Best for |
|---|---|---|---|---|---|
| deepface (this) | 23.6k | Library | intermediate | 6 days ago | Python developers prototyping face verification or face search |
| face_recognition | 56.9k | Library | intermediate | 4 months ago | Python developers prototyping photo sorting or face matching |
| facenet | 14.4k | AI model / agent | advanced | 3.3 years ago | Researchers reproducing the FaceNet paper with TensorFlow |
| onnxruntime | 22.2k | Library | intermediate | 4 days ago | Developers who want to deploy a trained model inside an application or service |
| recommenders | 22k | Library | intermediate | 4 days ago | Data scientists prototyping recommendation models |
| face-api.js | 18k | Library | intermediate | 2.8 years ago | Web developers adding face detection to a browser page |
Stats synced from GitHub. The assessment above was drafted with AI from the project's README on 2026-10-29 and may miss recent changes — check the README before relying on a command. MIT licence: free to use, modify and distribute, including commercially, as long as you keep the copyright notice.