Ever since the renaissance of Deep Learning in the past two decades, Artificial Intelligence has bloomed into an interesting and disruptive methodology, which has influenced many industries and has significantly improved the well-being of all living beings in the world. Cutting edge medical equipment powered by AI, and intelligent results and evaluations have eased the doctor’s role in diagnosing malignant and complex diseases; smart object detection algorithms have transformed a Sci-Fi concept, self-driving cars, to become a reality, assisting humans to have safe and smooth journey; robots have made human life easier, from answering customers using intelligent chatbots, to perform labour-intensive tasks and help to decrease human-casualty in high-risk environments, are just a few examples on how AI has revolutionized different industries. This article would focus on how AI has influenced the security field, creating a disruptive and proficient method in biometrics: face recognition.
A simple definition of biometrics is a measurement or an analysis of a person’s unique characteristics and behavior and is used for identification for access-control (giving a specific person permission to use resources or permitting a specific person access to specific places), and also for identifying and recognizing a target from a group. Biometric systems have existed even in the historic era in the form of a human, as trained guards and knights verify and allow people to visit the king or to visit specific places. And, as history clearly depicts, humans are susceptible to be tricked or even be treacherous. This enabled the rise of automated biometric systems in the last century, increasing security and decreasing the possibility of failure of the system. Scanning unique ID cards and using fingerprints as identification are some of the automated biometric systems that have aided security for a long time; but in the current era, they are deemed imperfect and a new technique is needed for a robust and effective identification, and this ignited the birth of automated facial recognition systems.
What is Face Recognition?
Before exploring how Deep Learning assists in Face recognition, let’s have a brief look at how humans and animals recognize faces. We, as humans, meet and interact with different people in our day-to-day life, and would instantly recognize known faces and also quickly familiarize ourselves when meeting new people. The processing power of the brain for facial recognition is instantaneous, as our brain is trained for recognizing faces since our birth, and this explains how babies generally feel comfortable around family members and start crying when they see strangers. Humans and animals can recognize the distinct features of each faces that they encounter so swiftly, that we don’t look back on how we instantly recognize faces: the shape of the nose, size of the ears, skin-tone, and position of eyes are some of the many features that humans and animals instantly capture and recognize to distinguish different people, and Deep Learning researchers have attempted to mimic the face recognition function by utilizing Artificial Neural Networks to build automated face recognition systems.
In order to gain an in-depth understanding of how face recognition can be implemented efficiently, our research team at Rootcode AI decided to implement face recognition using two methods: using object classification, and using Siamese networks and triplet loss, therefore, a clear insight can be obtained on why Triplet Loss and Siamese Networks work better than the normal classification techniques.
Face recognition: using classification techniques
Our research team attempted to build a face recognition model using the knowledge from building object classification techniques to see how far the traditional classification systems can support face detection. To progress with our initial implementation, we needed plenty of images, just as we would generally need for a standard object classifying task. Therefore, in order to create a new dataset, we utilized OpenCV’s functions to capture faces from video streams and then created a dataset from those images.
Then by using transfer learning techniques, we used a pre-trained model, VGG-16 (Visual Geometry Group), to train and classify the dataset that we created. The model was compiled by using the ADAM optimizer and categorical cross-entropy as a loss function and the model was trained for 5 epochs. The validation accuracy and loss performed well, but the trained model faced severe shortcomings.
One of the main issues in training such a model is that we required a lot of data. For image classifying tasks, collecting a high number of images is acceptable, but in a face recognition system, practically it is a huge waste of time if it is necessary to collect thousands of images of a person in order to identify the said person. And this model performed poorly on data that it had not seen before: that is, the model failed to recognize the person from data that is different from the train data. Therefore, by using this model, we would need different images with varied scenarios of the same person in order to recognize and verify him/her. These hindering issues are solved by Siamese Networks and Triplet Loss.
Siamese Networks and Triplet Loss
An ideal face recognition system should be able to recognize a person using just one or few images, as to how humans generally recognize people, and this type of task is known as the One-Shot Learning problem. Generally, deep learning models do not work well with a small amount of data, as we cannot build a fully-fledged Neural Network with Convolutional Layers to capture the features. Therefore, in order to solve the One-Shot Learning problem, a similarity function is required, which compares two given images and returns whether there is a match between them. Siamese Networks and Triplet Loss function helps to solve the One-Shot Learning problem.
Siamese Networks are Neural Networks that are used to compare the feature encodings of a particular image. A simple explanation would be, in a particular Neural Network Architecture, we would remove the final classification layer (e.g. a SoftMax layer used to classify the class of a particular image) and use the penultimate layer, which would contain the feature encodings of the particular image. The feature encodings will be compared between different images to find a match and build a face recognition system. The comparison is processed by the Triplet Loss Function.
Instead of using loss functions that are used for image classification (cross-entropy), in order to train a Siamese Network, Triplet Loss is used. The Triplet Loss function uses 3 parameters to measure the loss: an anchor image, a positive image (an image that matches the anchor image), and a negative image (an image that is different from the anchor image). The following is the mathematical equation for the Triplet Loss function:
where a denotes the anchor image, p depicts the positive image, n depicts the negative image, d(a,p) and d(a,n) denotes the difference between the encodings of the anchor and positive image, and anchor and negative image respectively, margin is a hyperparameter that is used to measure how well two images must be identified.
Generally, the difference between the anchor image and a positive image must be less and the difference must be high between the anchor image and a negative image. margin helps to define the limit on how far the dissimilarities must be and helps to differentiate 2 images better. Using the Triplet Loss, the Siamese Network can now be trained by using comparatively fewer data. Here, we select an anchor image, and randomly obtain a positive and a negative image to calculate the weights and biases of our Siamese Network. Therefore, by using Siamese Network and Triplet Loss, the One-Shot Learning problem is solved, and face recognition systems can be built with less data effectively. This method works more efficiently than the former method (using image classifying methods) as Siamese Networks and Triplet Loss use the feature encodings rather than a label, enabling it to spot similarities and differences in different types of images.
Why Face Recognition Systems are important now than before
Face Recognition has disrupted the traditional security measures, and currently, many technologies prefer Face Recognition systems rather than other biometric systems like the fingerprint scanner and passcode. Comparatively, creating a Face Recognition system costs less than creating a Fingerprint Secure system, as only a camera would suffice for the former, and the latter requires specific external hardware. And, Face Recognition provides better security and speed compared to Fingerprint systems, and this is clearly evident as modern smartphone manufacturers are currently shifting towards Face Verification security. According to Apple, the probability of a random person unlocking an iPhone using Face ID is 1 in a million, therefore more secured compared to their Touch ID (probability of 1 in 50,000) and their 4-digit passcode (probability of 1 in 10,000).
Facial Recognition could benefit many organizations too, as it can be used for providing employees security access, replacing ID cards and fingerprints. Baidu, a technological giant in China, has switched from the customary ID cards to Face Recognition as it is faster and more secure. Intel has also deployed Face Recognition systems in their office at Oregon, USA, and in the upcoming years, it is expected to see many companies shift from traditional verification systems to Face Recognition.
Other than biometric systems, Face Recognition addresses other major security issues. Consumer industries, such as clothing stores and supermarkets, can utilize Face Recognition software to monitor their customers to provide a detailed and personal experience for the customers. Crimes can be reduced thanks to Face Recognition, as criminals and suspects can be apprehended by identifying them on CCTV footage. AI and Face Recognition transform the obsolete and static CCTV to intelligent human-like vision.
With all its positive impact on human life, Face Recognition has some security concerns as well, and they are currently being addressed. A person’s face is sensitive data, as that can be used for any adverse outcomes, therefore it is extremely crucial in protecting the data of the consumers, and this has caused doubts on Face Recognition among the tech community. Tech giants such as Apple, Samsung, IBM provide many secure Face Recognition systems for their customers.
Considering the current situation, the need for Face Recognition systems is very important. The COVID-19 pandemic has made non-contact verification critical rather than other older verification methods (which are mainly contact), and Face Recognition helps to address that issue. And, in the upcoming years, we can surely witness a flourish in the tech as well as other industries as Face Recognition makes its mark.