Skip to content

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
5 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
Step-by-step guide: how to use deepfaceInstall, first run, examples, tips and FAQs

How to get it

  1. 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 deepface

    Install with TensorFlow backend

    pip install "deepface[tensorflow]"

    Install with PyTorch backend

    pip install "deepface[pytorch]"
  2. 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. 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

ProjectStarsTypeLevelUpdatedBest for
deepface (this)23.6kLibraryintermediate5 days agoPython developers prototyping face verification or face search
face_recognition56.9kLibraryintermediate4 months agoPython developers prototyping photo sorting or face matching
facenet14.4kAI model / agentadvanced3.3 years agoResearchers reproducing the FaceNet paper with TensorFlow
onnxruntime22.2kLibraryintermediate4 days agoDevelopers who want to deploy a trained model inside an application or service
recommenders22kLibraryintermediate4 days agoData scientists prototyping recommendation models
face-api.js18kLibraryintermediate2.8 years agoWeb 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.