Self-hosted, local-first video knowledge base that indexes your videos with transcription, frame analysis and embeddings, then lets you search scenes in natural language.
serengil/deepface
A Python library for face recognition and facial attribute analysis, covering age, gender, emotion and race, with multiple pluggable models and detectors.
- Stars
- 23,653
- Forks
- 3,210
- Open issues
- 4
- Last commit
- 2 days ago
What is it?
DeepFace is a Python framework for face recognition and facial attribute analysis. It wraps several face recognition models, including VGG-Face, FaceNet, ArcFace, OpenFace and SFace, and a range of face detectors such as OpenCV, RetinaFace, MTCNN, MediaPipe and YOLO variants. Developers can call high-level functions like verify, find, analyze and represent in a single line, while the library handles detection, alignment, normalization and vector comparison in the background.
Beyond one-to-one verification and folder-based search, DeepFace supports database-backed registration and search through backends such as PostgreSQL, pgvector, MongoDB, Redis and Qdrant, with optional approximate nearest neighbor search. It also provides real-time webcam streaming, anti-spoofing checks, and a REST and gRPC API that can run directly or in Docker. The default inference engine is ONNX Runtime, with TensorFlow and PyTorch available as optional extras.
Key features
- 01Face verification and 1:N face search over folders or databases.
- 02Age, gender, emotion and race attribute analysis.
- 03Multiple recognition models and detector backends that can be switched by argument.
- 04Real-time webcam streaming with recognition and attribute analysis.
- 05Optional anti-spoofing check to detect fake faces.
- 06REST and gRPC API servers, with Docker support.
Use cases
- Building a face login or identity check feature in a Python application.
- Searching a photo collection for a specific person.
- Running face analysis as a microservice called from a web or mobile app.
- Prototyping computer vision projects that need face embeddings.
Quick start
- 1
Install the library from PyPI (ONNX Runtime backend by default)
pip install deepface - 2
Import the library in Python
from deepface import DeepFace - 3
Verify whether two face images show the same person
result: dict = DeepFace.verify(img1_path = "img1.jpg", img2_path = "img2.jpg")
Things to know
- Face recognition and attribute analysis raise privacy and ethical concerns, so check the legal rules where you deploy it.
- Full TensorFlow or PyTorch backends add one to several GB of dependencies.
In collections
Topics
FAQ
- What is deepface?
- A Python library for face recognition and facial attribute analysis, covering age, gender, emotion and race, with multiple pluggable models and detectors. DeepFace is a Python framework for face recognition and facial attribute analysis. It wraps several face recognition models, including VGG-Face, FaceNet, ArcFace, OpenFace and SFace, and a range of face detectors such as OpenCV, RetinaFace, MTCNN, MediaPipe and YOLO variants. Developers can call high-level functions like verify, find, analyze and represent in a single line, while the library handles detection, alignment, normalization and vector comparison in the background.
- Is deepface free to use? What license does it have?
- deepface is open source under the MIT license. Check the license terms before using it in commercial products.
- Is deepface still maintained?
- Actively maintained. The last commit to deepface was on Nov 5, 2026.
- What can I use deepface for?
- Building a face login or identity check feature in a Python application. Searching a photo collection for a specific person. Running face analysis as a microservice called from a web or mobile app. Prototyping computer vision projects that need face embeddings.
- How do I install deepface?
- Install the library from PyPI (ONNX Runtime backend by default): pip install deepface Import the library in Python: from deepface import DeepFace Verify whether two face images show the same person: result: dict = DeepFace.verify(img1_path = "img1.jpg", img2_path = "img2.jpg")
- Where can I get deepface?
- The source code and installation instructions are on GitHub: https://github.com/serengil/deepface
Summary generated by AI from the project's README. GitHub stats refresh daily.
Related projects
A unified Python library for face detection, recognition, tracking, landmarks, parsing, gaze, attributes and anti-spoofing behind one API.
A Python library for self-supervised learning on images, offering PyTorch building blocks for training vision models without labels.
A lite C++ toolkit of 100+ AI models for detection, face recognition, segmentation and matting, running on ONNXRuntime, MNN, TensorRT and others.
Self-hosted, local-only NVR and AI computer vision software for object, motion and face detection on your own cameras.
A privacy-first desktop app that sorts and groups your photos by face, date, and location, running fully offline on Windows and macOS.