Skip to content

face_recognition

A Python library and command-line tool for finding and recognizing faces in photos.

Stars
56.9k
Forks
13.7k
Licence
MIT
Language
Python
Last update
4 months ago
Type
Library

What it is

face_recognition is a Python library that detects faces in images, locates facial features like eyes and nose, and compares faces to tell whether two images show the same person. It also ships a command-line tool that can match a folder of unknown photos against a folder of labeled people. The README says it is built on dlib's deep-learning face recognition model, which it reports at 99.38% accuracy on the Labeled Faces in the Wild benchmark.

  • Find all faces in a photo and get their pixel coordinates with the face_detection command
  • Compare a known person's photo against unknown images to see if they match
  • Extract facial landmarks such as eyes, nose, mouth and chin
  • Run recognition on a live webcam feed by combining it with another Python library, per the README example

Great for

  • Python developers prototyping photo sorting or face matching
  • Hobbyists who want to label people across a folder of personal photos
  • Researchers who need a simple baseline face recognition pipeline
  • Developers adding face detection to a script or small app

Not ideal for

  • Anyone needing official Windows support, since the README says Windows is not officially supported
  • Projects that need to run without installing dlib and cmake, since installation is the hardest part according to the README
  • Surveillance or identification of people without their consent, which raises serious privacy and legal concerns the README does not address
Step-by-step guide: how to use face_recognitionInstall, first run, examples, tips and FAQs

How to get it

  1. 1

    Install with a package manager

    You'll need: Python 3.3+ (README also mentions Python 2.7) · macOS or Linux · dlib with Python bindings installed first · cmake

    Install cmake (macOS, per README)

    brew install cmake

    Install the library from PyPI

    pip3 install face_recognition
  2. 2

    Run it

    • Install dlib with Python bindings, following the linked guide for your OS
    • Install cmake
    • Run pip3 install face_recognition
    • Create a folder of labeled photos, one per person, named after them
    • Run face_recognition ./pictures_of_people_i_know/ ./unknown_pictures/ to match unknown photos
  3. 3

    Get the most out of it

    • Use --tolerance to make matching stricter; the README says the default is 0.6 and lower values are stricter
    • Use --show-distance true to see the distance score for each match when tuning tolerance
    • Use face_detection on a folder to get pixel coordinates of faces without identifying anyone
    • Check the examples folder, including the webcam example referenced in the README
    • Use the Docker option mentioned in the README if local installation fails

Downloads

Strengths

  • Very short Python API for detection, landmarks and comparison
  • Command-line tools work on whole folders of images
  • MIT licensed and widely used, with a large star count

Trade-offs

  • Installation requires dlib and cmake, which the README describes as a multi-step process
  • Windows is not officially supported and the README notes a silent failure bug on Jetson Nano unless a dlib line is edited
  • README examples and install instructions reference older Python versions (3.3+ or 2.7), so modern setup may need checking

How it compares

ProjectStarsTypeLevelUpdatedBest for
face_recognition (this)56.9kLibraryintermediate4 months agoPython developers prototyping photo sorting or face matching
deepface23.6kLibraryintermediate5 days agoPython developers prototyping face verification or face search
face-api.js18kLibraryintermediate2.8 years agoWeb developers adding face detection to a browser page
facenet14.4kAI model / agentadvanced3.3 years agoResearchers reproducing the FaceNet paper with TensorFlow
caire10.9kCLIintermediate7 days agoDevelopers who need to resize images inside a Go program
qlib49.9kLibraryadvanced7 days agoQuant researchers who want a structured ML workflow for stock data

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.