Skip to content

Face Recognition using Face-net and Retina Face detection start of the art - Pytorch

Notifications You must be signed in to change notification settings

Gopi-Durgaprasad/Face_Recognition

Repository files navigation

Face_Recognition

This is a repository for Face_Recognition using FaceNet Inception Resnet (V1) model in pytorch and using state of the art Face Detection model called Retina Faces

Started with Simple Face Recognition model to understand.

Existing Research

FaceNet: A Unified Embedding for Face Recognition and Clustering: link

RetinaFace: Single-stage Dense Face Localisation in the Wild : link

Github Repositorys

FaceNet Implementation : link

FaceNet PyTorch Implementation : link

RetinaFace PyTorch Implementation : link

Get Started

We are stating with pre-trained FaceNet model implemented in PyTorch link

From this repo, we download pre-trained weights and models.

ModelName : VGGFace2 link

Weights : link

Challenges

Face Recognition there are mainly three challenges.

  1. Detecting Faces
  2. Get Embeddings for faces
  3. Train model Clustering/Classification/Similarly to recognize the Face

1. Detecting Faces:

The first main challenge is Detecting Faces from a given image, there are many models to detect faces in an image

  • The first main challenge is Detecting Faces from a given image.
  • There are so many models to detect faces in this link
  • We are using RetinaFace (sota) Face Detection model

2. Get Embeddings for faces

The second challenge is getting embedding for the detected faces, we are using FaceNet Model for getting Embeddings for faces.

  • Trine a model using FaceNet architecture / Download pre-train model and train.
  • FaceNet Implementation :link
  • Pretrained Model :link
  • Pretrainde Weights :link

3. Train model Clustering/Classification/Similarly to recognize the Face

There are three many ways to train a model to recognize the face

  • Using Clustering
  • Using Classification
  • Using Similarity Matrix

Simple Model

We are build simple model form this [link](https://www.pyimagesearch.com/2018/09/24/opencv-face-recognition/)

  • For more detailed understanding and code : simple_EDA.ipynb
  • TSNE Visulization for Embeddings

Observe TSNE Visulization of 512-d Embeddings those are well clustered


  • Distance (Best threshold for the verification

    Using this Distance threshold we can easily desided threshold to Recognize faces

Observe Distance threshold is 0.74 and it gives 0.98 Accuracy, to recognize faces using simple Euclident distance


  • Distance distributions of positive and negative pairs

Observe distributions of positive and negative pairs, almost well separated using threshold 0.74 wich gives high Accuracy


Run this files

1. Extract Embeddings: $python3 Simple_extractEmbeddings.py

2. Train Model: $python3 Simple_trainModel.py

3. Recognize Face: $python3 Simple_recognize.py --image kohili-sachin-dhoni.jpg

Input Image Output Image

Retina Faces (state of the art) Face Detection Model

  • For accurate face detection, we are using Retina Face model to detect faces.
  • Retina Faces is state of the art model to detect faces

Face Detection Outputs:

About

Face Recognition using Face-net and Retina Face detection start of the art - Pytorch

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published