Coders Packet

Face Recognition and Face Verification in Python using Keras

By Hritwick Manna

In this tutorial, We are going to build a facial recognition system model in Python using Keras. Most of the ideas are taken from FaceNet and DeepFace.

Face recognition problems have been divided into two groups:

  • Face Verification - example, when you unlock your smartphone using your face is using face verification.
  • Face Recognition - example, an office employee entering the premises of the office area just by looking at the security camera and then allowing him/her to enter the office.

In this tutorial, we will:

  • Use the triplet-loss function.
  • Use a pre-trained model.
  • perform face recognition and face verification

After going through the code with the explanation following are the things you will see.

Concept:

We get an image from a database and compare it with the live image pixel by pixel. If the distance between the stored and real image is less than the minimum distance then it may be the same person whose image is stored in the database of a system. This is calculated by a triplet loss function given by 

Lossless Triplet loss. A more efficient loss function for… | by  Marc-Olivier Arsenault | Towards Data Science

 

1)Results

  • Our facial recognition model is doing well. It only allows the persons to come in who are part of the office, and people now not need to carry their i-card anymore.
  • We have now seen how an advanced facial recognition model works.

2)Ways by which we can improve our facial recognition model

Even though we haven't used here, there are some more ways to improve the model furthermore:

  • Insert some more images of the individual person (taken on different days, different light conditions, etc.) into the server of the system. When a new image is given, contrast the new face to other images of that individual person. This would lead to increase accuracy.
  • Cut the images for just containing the face of the person and less area around the face. This process removes most of the unwanted distortion over the face region, and also makes our model more efficient.

What we should remember from this tutorial

  • Face verification easily solves the matching problem while face recognition solves a harder matching problem.
  • To gain an understanding of the encryption of facial expression, a triplet-loss is a fruitful cost function for training a deep layer network can be used.
  • Calculating the length between two images, encryption will allow us to identify whether they are the pictures of the same person or not. The matching encryption can be used for recognizing and verifying the images. 

I hope all this will help most of you.

 

Download Complete Code

Comments

No comments yet

Download Packet

Reviews Report

Submitted by Hritwick Manna (hritwickmanna)

Download packets of source code on Coders Packet