Facial Recognition Process

Samrat Sahoo
Analytics Vidhya
Published in
2 min readMar 11, 2020
Source: Wikimedia Commons[teguhjatipras / CC0]

With computer vision technologies such as facial recognition coming to the forefront of many modern applications, the popularity of the technology rises. Despite the popularity, many fail to understand the underlying mechanisms that allow for facial recognition to work.

Step 1: Pre-processing Data Sets

The first major step in the facial recognition process is the preprocessing of data. For a computer to recognize a face, the computer must have data to base the recognitions off of. Because of this, the user must first input some sample data. There are two approaches to the amount of data inputted. The user has the option of inputting a large amount of data and training a neural network or a small amount of data and using techniques such as transfer learning through the usage of pre-trained models. For the sake of simplicity, today we will go the transfer learning route.

Through the transfer learning route, you would import a pre-trained model that would then preprocess the images into data. Since a computer cannot handle raw image data, it goes through an encoding process to turn the images into numerical data (NumPy Arrays) known as embeddings. These embeddings are used in future steps.

Step 2: Facial Detection

The second step to the facial recognition process is face detection through the webcam. This part is very simple as XML files known as haar cascades can be used concurrently with the OpenCV library to do facial detection.

Step 3: Variance Calculations

To find which face is the closest, we must find the variance or “distance” between the faces. To do this, we need to quantify the matrices that we got earlier from the preprocessing step into a single number which can be done by taking a Frobenius norm. We then compare these values with what is found on the webcam and the face with the least variance is the face that is recognized.

Closing Remarks

This process may seem very complicated, however, because of its formulaic nature, Adam Geitgey has developed a facial recognition library known as face_recognition that takes the transfer learning approach. The library is very well documented and it is an approach I took during the creation of my facial recognition based attendance tracker. I would highly recommend you to take a look as it is a fantastic first look at the world of facial recognition.

--

--

Samrat Sahoo
Analytics Vidhya

comp sci @ georgia tech 🐝 • formerly @ roboflow, cruise • I occasionally write: samratsahoo.com