How to Configure a Facial Recognition System for Face ID Authentication

This how-to article contains instructions for configuring an open-source facial recognition system for face id authentication.

There are a lot of benefits with face id authentication, one it forces conformity to one of the most violated information security policy of ‘password sharing’, it is quicker, safer and much more effective, and above all it is touchless! As a technology designer, I’m sure you’re confused about which service you should go to for your business needs. Let us understand the various technologies that are developed over the years to detect and recognize faces.

It is an exciting time in the market, and we in FIO Labs recently developed a Face Detection and Recognition Algorithm using Dlib Library, which can meet your business needs. Let me walk you through the various technologies and FIO Labs’ Face Recognition API to help you make the right decision! You’ll get to try the API for free at the end of the article!

Comparing FIO Labs’ Face Recognition API

Here is a table to compare various Face Recognition services available on the market:

Comparison of Facial Recognition features between Open Source and Paid versions.

Overview of FIO Labs’ Face Recognition System

Here is an overview of different libraries that we’ve used to create a powerful Facial Recognition API.

Libraries that make up our Facial Recognition API

OpenCV

OpenCV is an open-source Computer Vision and Machine Learning Library.

Before we go any further, what exactly is Computer Vision? It is a scientific field that deals with how computers can gain a high-level understanding of digital images or videos. Say, you want to know the footfall of a shopping mall, a task of this type assigned to a human will increasingly become an impossible task when you decide to scale up. Computer Vision can automate such tasks that the human visual system can do.

OpenCV is such a library that provides tools to achieve those tasks. It was built to provide a common infrastructure for computer vision applications and to accelerate the use of machine perception in commercial products.

Face Recognition using OpenCV and Dlib Libraries

The library has more than 2500 optimized algorithms. These algorithms can be used to:

  • Detect and Recognize faces
  • Identify objects
  • Classify human actions in videos
  • Track camera movements
  • Track moving objects
  • Extract 3D models of objects
  • Stitch images together to produce a high-resolution image of an entire scene
  • Find similar images from an image database
  • Remove red eyes from images taken using flash
  • Follow eye movements
  • Etcetera

Also, it has an active community of developers and supporters.

HaarCascade Classifiers

Face Recognition using HaarCascade classifier

Haar Cascade Classifier is an effective object detection approach that was proposed by Paul Viola and Michael Jones in their paper, “Rapid Object Detection using a Boosted Cascade of Simple Features” in 2001. It is a Machine Learning-based approach where a cascade function is trained from a lot of positive and negative images. It is then used to detect objects in other images.

HaarCascade Classifiers are huge.XML files. The algorithm has four stages:

A normal image would have at least 6000 features in it. But, we need only those features where a face is located. So, instead of applying all 6000 features on a window, the features are grouped into different stages of classifiers and applied one-by-one. If a window fails the first stage, discard it. We don’t consider the remaining features on it. If it passes, apply the second stage of features and continue the process. The window which passes all stages is a face region.

Face Recognition using OpenCV and Dlib Libraries

HaarCascade is well known for being able to detect faces and body parts in an image but can be trained to identify almost any object.

The .XML files consist of different feature sets. For example, let’s say we need to detect only the ‘eyes’ of a person. If you go to their GitHub page, you would notice that there is an.XML file containing the feature set to detect eyes. In the same way, we’ve feature sets for full-body, lower-body, frontal-face, and so on.

Dlib Library

In Deep Learning we typically train a network to:

Accept a single input image
And output a classification/label for that image
However, Deep Metric Learning is different. Instead of trying to output a single label (or even the coordinates/bounding box of objects in an image), we are instead outputting a real-valued feature vector. For the Dlib facial recognition network, the output feature vector is 128-d (i.e., a list of 128 real-valued numbers) that is used to quantify the face. Training the network is done using triplets:

A single ‘triplet’ training step

Here we provide three images to the network:

  • Two of these images are example faces of the same person.
  • The third image is a random face from our dataset and is not the same person as the other two images.

Our network quantifies the faces, constructing the 128-d embedding (quantification) for each.

From there, the general idea is that we’ll tweak the weights of our neural network so that the 128-d measurements of the two Will Ferrel will be closer to each other and farther from the measurements for Chad Smith.

ResNet-34

Our network architecture for face recognition is a ResNet network with 29 convolutional layers. It is essentially a version of the ResNet-34 from the Deep Residual Learning for Image Recognition paper by He et al., but with fewer layers and the number of filters reduced by half. More about the architecture in this link. This method uses a Maximum-Margin Object Detector ( MMOD ) with CNN based features.

The network itself was trained by Davis King on a dataset of ~3 million images. On the Labeled Faces in the Wild (LFW) dataset the network compares to other state-of-the-art methods, reaching 99.38% accuracy.

Deep Learning Facial Recognition

face_recognition Library

The dlib library, maintained by Davis King, contains our implementation of “deep metric learning,” which is used to construct face embeddings used for the actual recognition process. The face_recognition library, created by Adam Geitgey, wraps around Dlib’s facial recognition functionality, making it easier to work with.

This library can be used to:

  • Manipulate facial features of a person (think of BeautyPlus App)
  • Detect and Recognize faces and output location of faces in a picture on Command Line Interface
  • Blurs part of an image
  • Identifies faces real-time

The models it uses to detect faces:

  • HOG
  • CNN

So, Why choose FIO Labs’ Face Recognition?

FEATURES WE OFFER

What are you waiting for?

We’ve now made it even easier to get started with FIO Labs Face Recognition. Get your free consultation and API trial by leaving a comment below or booking a session here.

We believe FIO Labs never fails to keep their promise when it comes to providing quality services. Our enterprise expertise and industry leadership mean you’re in safe hands.

If you are interested in learning more about what we do at FIO Labs and the benefits of face recognition or have some questions about this page, feel free to send us a message at [email protected] — we’d love to hear from you.

How to reach FIO Labs:

Leave a comment below | Book a FREE 30-min session for our on-going Pro Bono Services or Fill in our LinkedIn Form| Contact Us | About FIO Labs | Blog

References

One thought on “How to Configure a Facial Recognition System for Face ID Authentication

Leave a Reply

Your email address will not be published. Required fields are marked *

Begin typing your search term above and press enter to search. Press ESC to cancel.

Back To Top