About The world's simplest facial recognition API for the command line and Python: Here's Face_recognition!

Jan. 17, 2018, 4:58 p.m. By: Kirti Bakshi


A facial recognition system is basically a computer application that is capable of identifying or verifying a person from either a digital image or even a video frame from a video source as well. One of the simple ways to do this is to compare the selected facial features from the image and a face database.

This system of recognition is typically used in security systems and therefore can be compared to other biometrics such as fingerprint or eye iris recognition systems. In these recent years, it has also become very popular as a commercial identification and marketing tool.

The world's simplest facial recognition API for Python and the command line: Face_recognition:

Here, in the same context, we discuss a model that with the world’s simplest face recognition library helps to recognize as well as manipulate faces from Python or from the command line.

This model has been Built making the use of Dlib’s state-of-the-art face recognition that is built with deep learning. This modern toolkit in C++ called Dlib comprises of machine learning tools and algorithms in order to create complex software in C++ to solve problems that are related to the real world. This model is said to have an accuracy of 99.38% on the Labeled Faces in the Wild benchmark. The model also comes with a simple tool that lets an individual from the command line do face recognition on a folder of images: The face_recognition command line tool.

One Of The Setbacks In The Model:

The thing to note here is that the face recognition model has been trained on adults and therefore does not work very well when it comes to children as it tends to mix up children quite easy using the default comparison threshold of 0.6.

Features of the model:

Face Detection:

  • Find faces in a photograph: Find all the faces that appear in a picture

  • Find faces in a photograph using deep learning

  • Find faces in batches of images w/ GPU using deep learning

Facial Features:

  • Identify as well as manipulate specific facial features in a photograph: Get the locations and outlines of each person's eyes, nose, mouth and chin.

  • Apply (horribly ugly) digital make-up: think of 'Meitu'

Facial Recognition:

  • Find and recognize unknown faces in a photograph based on photographs of known people: Recognize who appears in each photo.

  • Instead of only matching with True/False one can now Compare faces by numeric face distance

  • Recognize faces in live video using your webcam - Simple / Slower Version (Requires OpenCV to be installed)

  • Recognize faces in live video using your webcam - Faster Version (Requires OpenCV to be installed)

  • Recognize faces in a video file and write out new video file (Requirement of OpenCV to be installed as well)

  • Recognition of faces on a Raspberry Pi w/ camera

  • Run a web service to recognize faces via HTTP (Requires Flask to be installed)

  • Recognize faces with a K-nearest neighbours classifier

Apart from all the features mentioned above, An individual can use this library with other Python libraries to do real-time face recognition as well!

Installation Requirements:

  • Python 3.3+ or Python 2.7

  • macOS or Linux (Windows not officially supported, but might work)

Note: GPU acceleration via Nvidia's CUDA library is required in order to get good performance with this Face Recognition model. One will also have to enable CUDA support when compiling Dlib.

For More Information: GitHub