riya-17 / FaceRecognition

Recognizes faces
GNU General Public License v3.0
105 stars 82 forks source link

Note: NOT ACTIVE


Face Recognizer

Face Recognizer identifies the face of an individual by their name with the help of their facial features.

Face 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

Install cmake library

pip install cmake

Clone the dlib repository

git clone https://github.com/davisking/dlib.git

Make build directory

cd dlib
mkdir build
cd build

Install setup.py

cmake ..
cmake --build
cd ..
python setup.py install

Setup

Windows:

pip install -r requirements.txt

Linux:

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

python FaceRecognizer.py

How Does It Work?

* An image that contains the face to be recognized is loaded (e.g., input image).

* The face is detected and segmented.

* The face is aligned if it is not aligned straight

* Landmarks (e.g., 68 (x, y) coordinates) are detected from the facial structure.

* The detected face landmarks are encoded (e.g., 128-d embeddings of the image are created).

* The input image[encoding] is passed to the k-NN model for classification.

* The k-NN model returns the name with the highest precision



Outputs:

Input Image

Original Image Original Image!

Aligned image Aligned Image

Landmark

Detected face




Another Recognition:

Input Image

Original Image

Aligned Image

Landmarks

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