Skip to content
Recognizes faces
Python
Branch: master
Clone or download
Latest commit 1f82afd Jul 2, 2019

README.md

Face Recognizer

Face Recognizer is about Recognizing Faces of an Individual with the help of their facial features.

Facial Recognizer uses deep learning algorithms to compare a live capture or digital image with the stored faceprints(also known as datasets) to verify an identity.

The Algorithm used for classification is k-NN model i.e. k-Nearest Neighbor classifier. It uses Euclidean distance to compare images for similarity.

Prerequisites

Build and install dlib library

git clone https://github.com/davisking/dlib.git
mkdir build
cd build
cmake ..
cmake --build
cd ..
python setup.py install

Setup

pip install -r requirements.txt

Set the path of the input images in the code and run the following command:

python FaceRecognizer.py

How it Works?

  • Image from which Face needs to be Recognized is loaded i.e. Input Image.
  • The face is detected and cropped.
  • if the face is not Aligned Straight then it is aligned.
  • Landmarks are detected i.e. 68 (x, y)-coordinates that map to facial structures on the face.
  • The Detected Face is encoded i.e. 128-d embeddings of the image are created.
  • The input image[encoding] is passed to k-NN model for classification.
  • k-NN model return the name with the highest votes

Outputs:

  • Input Image - Image in which Faces are to be recognized:

Input Image

  • Original Image - Image consists of cropped original Image

Original Image Original Image!

  • Aligned Image - Aligning the image increases the efficiency if the Algorithm

Aligned image Aligned Image

  • Landmarks - Shows the Landmarks of theDetected Faces

Landmark

  • Detected Face - The Face is recognized and the name of the recognized face is displayed along with the face. If the face does not belong to the Dataset than the Face is tagged as Unknown.

Detected face




Another Recognition:

  • Input Image:

Input Image

  • Original Image:

Original Image

  • Aligned Image:

Aligned Image

  • Landmarks :

Landmarks

  • Detected Face :

Detected Face


encode-faces.py

It is used to create 128-d face embeddings of the input image as well as custom dataset. These embeddings are used to compare input image(embeddings) with the dataset(embeddings), the one with the highest votes is preferred.

DAT file

Link to Download Dat File

Resources

You can’t perform that action at this time.