How face recognition works?

    • stunntech blog author image
    • Bivin Vinod

  • |
  • Jan. 22, 2020

Identifying yourself online is one of the most time-consuming business concerns of the modern age. It helps to combat fraudulent behaviour and keep us safe.

Facial recognition is the process of identifying (Who are you?) or verifying (Are you really the person you say you are?) the identity of a person using their face. It captures, analyzes, and compares patterns based on the person's facial details.


Why facial recognition?

There are a lot of other signatures via the human body also exist, such as fingerprints, iris scans, voice recognition, digitization of veins in the palm etc. But Facial biometrics continues to be the preferred biometric benchmark because it's easy to deploy and implement. There is no physical interaction required by the end-user. Moreover, face detection and face match processes for verification/identification are speedy.


So how does face recognition works?

(This is based on how we implemented face recognition using Python)


  • In the case of facial biometrics, a 2D or 3D sensor "captures" a face. It then transforms it into digital data by applying an algorithm before comparing the image captured to those held in a database.


  • There are two steps for face authentication:


1. extract face encodings from the face

For extracting face encodings from the face we use a python library python face_recognition 1.2.3.

This library recognizes and manipulates faces from Python or from the command line with the world’s simplest face recognition library. Built using dlib’s state-of-the-art face recognition built with deep learning. The model has an accuracy of 99.38% on the Labeled Faces in the Wild benchmark. If we input an image to this library it extracts all faces from the given images and return is as an array of encodings. If the images have n number of faces is return an n length array of array. Each array element is also an array and it has full-face descriptions in the vector form. We need to check only 1 face in the image. When the image has multiple faces or no face the registration blocks.


Adjusting Tolerance/ Sensitivity 

If you are getting multiple matches for the same person, it might be that the people in your photos look very similar and a lower tolerance value is needed to make face comparisons more strict. The default tolerance value is 0.6 and lower numbers make face comparisons more strict.


When the algorithm returns the face encodings (it is vector array that describes the distance between the eyes, the distance between the bottom of the nose and the top of the upper lip, etc.) we need to store it in our database for comparing this encoding with another his/her images.


2. compare registered face and login face

We need to extract the face encodings from the login face and compare it with the registered face encodings. For comparing two faces We use Euclidean distance. It measures how far away two items are.

  • Once we have these measurements, store the values for each image in a vector and we can apply the Euclidean distance. Effectively, each image is represented as a point in the m-dimensional feature space, where each measurement is a dimension. To select good features, make sure they are not correlated (ie they are independent of each other) and are the same scale.


This automated systems can be used to identify or check the identity of individuals in just a few seconds based on their facial features: spacing of the eyes, bridge of the nose, the lips, ears, chin, etc.


It is pretty much tough to predict where the facial recognition technology would be in the coming years, but it will replace the traditional process of paying bills, opening bank accounts, legal procedures, user verification controls etc. The industries such as healthcare, retail, marketing, law enforcement and social media platforms will surely adopt.