skillfed

deepface

A Lightweight Face Recognition and Facial Attribute Analysis Framework (Age, Gender, Emotion, Race) for Python

deepface v0.0.100 587.6K downloads/30d#5,874 on PyPI23,282
Permissive license MIT Active released

What it is and what it does

DeepFace is a Python framework that wraps multiple state-of-the-art face recognition and analysis models (VGG-Face, FaceNet, OpenFace, DeepFace, DeepID, ArcFace, Dlib, SFace, GhostFaceNet, Buffalo_L) into a unified API. It handles the full face recognition pipeline—detection, alignment, normalization, representation, and verification—internally, so you can call high-level functions like `verify()`, `find()`, or `analyze()` with minimal setup.

The package supports three main workflows: one-to-one face verification (comparing two images), one-to-many face recognition (searching a database of embeddings stored in PostgreSQL, MongoDB, Neo4j, Pinecone, pgvector, or Weaviate), and facial attribute analysis (predicting age, gender, emotion, and race from images). It also includes real-time video streaming for continuous analysis. With 18 runtime dependencies including TensorFlow, Keras, OpenCV, and Flask, it brings substantial computational machinery but abstracts away the complexity of model selection and pipeline orchestration.

Use it for:

  • Verify whether two photos belong to the same person for identity confirmation or fraud detection workflows.
  • Search a database of employee or customer photos to identify individuals in new images for security or CRM applications.
  • Analyze facial attributes (age, gender, emotion, race) in batch or real-time video for demographic insights or sentiment analysis.
  • Build a real-time video stream analyzer that continuously detects and identifies faces from a webcam feed.
  • Register and index face embeddings in a vector database for large-scale face recognition at scale.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

DeepFace performs face recognition, verification, and facial attribute analysis (age, gender, emotion, race) using deep learning models, with support for real-time video streams and large-scale database searches.

Yes, if you need face recognition or facial attribute analysis and can accept the substantial dependency footprint (TensorFlow, Keras, OpenCV). The package is actively maintained, has no known vulnerabilities, uses a permissive MIT license, and abstracts away significant complexity. Install it if your use case justifies the disk and memory overhead; avoid it if you need a lightweight, minimal-dependency solution or are uncertain whether you need deep learning-based face analysis.

Install

deepface on PyPI

pip

pip install deepface

uv

uv add deepface

poetry

poetry add deepface

Installing deepface

Before you install

Low install friction with a pure Python wheel. Depends on 18 runtime packages including TensorFlow, Keras, and OpenCV, which may require significant disk space and compilation time on some systems. The project is actively maintained with recent commits and high GitHub visibility.

License in practice

MIT license permits commercial and private use with minimal restrictions, requiring only attribution and inclusion of the license notice.

Quickstart

pip install deepface

from deepface import DeepFace

# Face verification
result = DeepFace.verify(img1_path="img1.jpg", img2_path="img2.jpg")

# Facial attribute analysis
objs = DeepFace.analyze(img_path="img.jpg", actions=['age', 'gender', 'emotion', 'race'])

Requires TensorFlow and Keras; pre-trained models are downloaded on first use. OpenCV and Pillow need system libraries for image handling.

Verify before relying

  • Whether pre-trained model downloads are cached or re-downloaded on each environment setup
  • GPU acceleration support and CUDA/cuDNN requirements for production deployments
  • Latency and throughput characteristics for real-time streaming on typical hardware
  • Accuracy metrics for the supported models beyond the age MAE and gender accuracy cited in the description

Package facts

License MIT (permissive)
Python support supports the current Python release (>=3.7)
Install friction low — pure-Python wheel
Runtime dependencies 18 — requests, numpy, pandas, gdown, tqdm, Pillow, opencv-python, tensorflow, keras, Flask, flask-cors, mtcnn, retina-face, fire, gunicorn, lightphe, lightdsa, python-dotenv
Maintenance actively maintained — 97 days since the last release
Last repo commit
First released
Downloads 587,559/month — #5,874 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: deepface-0.0.100-py3-none-any.whl

License :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: Python :: 3

Tags

face recognition pythonfacial attribute analysisage gender emotion detectionface verification matchingface detection deep learningreal-time face analysisface database search
face-recognitioncomputer-visiondeep-learning

More Artificial Intelligence packages