Skip to main content

Face Recognition

Project description

Face Recognition

Simple library to recognize faces from given images

Face Recognition pipeline

Below the pipeline for face recognition:

  • Face Detection: the MTCNN algorithm is used to do face detection
  • Face Alignement Align face by eyes line
  • Face Encoding Extract encoding from face using FaceNet
  • Face Classification Classify face via eculidean distrances between face encodings

How to install

pip install git+

How to train custom model

Initialize model

from face_recognition import FaceRecognition

fr = FaceRecognition()

Train model with pandas DataFrame:

fr = FaceRecognition()


where 'df' is pandas DataFrame with column person (person name) and column path (image path)

Train model with folder:

fr = FaceRecognition()'/path/root/')

the root folder must have the following structure:


Save and load model

you can save and load model as pickle file.'model.pkl')
fr = FaceRecognition()


Predict image


Recognize faces from given image. The output is a JSON with folling structure:

  "frame": "image data", # base64 image with bounding boxes
  "elapsed_time": time, # elapsed time in seconds
  "predictions": [
        "person": "Person", # person name
        "confidence": float, # prediction confidence
        "box": (x1, y1, x2, y2) # face bounding box


For more details you can see:

Project details

Release history Release notifications | RSS feed

This version


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

facenet-face-recognition-0.1.tar.gz (5.5 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page