Skip to content

Ashish-Surve/FaceMatcher

Repository files navigation

FaceMatcher

This software recognizes people in a video or in an image. It uses MTCNN for detection/alignment of faces and FaceNet based model to recognise people. It also used the SVM model to classify people.

Star the repository if you want me to improve this code and optimise for better results

this code is improvement over the project created by ArunMandal53

Link to source

There was no documentation and no video recognition as well as a feature to save embeddings and compare them with other images.

FaceMatcher

How to use this model to train and recognise people.

  1. Clone this repository.
  2. Install these in a virtualenv created in the repository. a. tensorflow 1.7 b. numpy 1.16.1 c. opencv-python d. imutils
  3. In /dataset create a folder for each person you wish to recognise and add pictures of that person in the folder.
  4. execute extract_embeddings.py
  5. execute train_model.py
  6. execute Face_recognition_app.py

Your webcam should start in a few seconds and classify the faces by bounding boxes.

If you face any issue please contact me and also take a screenshot of the error.

Face-recognition

What things I have tried?

FACNET

=> I tried to use facenet library directly but could not find proper documentation or API for it.

=> There was no code available that provided me basic building block for code.

=> FaceNet by David Sandberg-- project looks mature, although at the time of writing does not provide a library-based installation nor clean API.

FACEMATCHER

PROS

It can detect similar faces even if the images compared have 10+ years of difference in ages. e.g is given below.

I have intentionally chosen pictures which are a little difficult to recognize but the result is astonishing

IMAGE 2 pic2

OUTPUT

pic3

  1. This model provides good implementation of MTCNN because of which the detection is accurate. => This code only provided basics for face detection and face matching.

CONS

  1. the speed seems to be a little low, though on an average I am getting 20 fps + while the video implementation is in beta stage.

  2. It uses old libraries. i.e. TensorFlow 1.7 and numpy 1.16.1

What problems did I face? There were a lot of library issue with the code I discovered and there was no requirement.txt available.

Solution => using virtualenv I created a new environment =>tensor-flow has no Session error. This occurs in 16.04 not in 18.04.

This error solved by downgrading to "tf 1.7.1" This resulted in another error related to numpy. I again downgraded numpy to numpy-1.16.1

Steps:

  1. follow above steps and get the libraries and virtualenv.
  2. Detect faces in an image or video using MTCNN and align them.
  3. extract embedding from it.
  4. match the embedding with image(euclidean distance is used as a parameter, if the threshold value generated is greater than 1.10 then the person are different and if less then the person is same.).
  5. display whether the persons are same or not.

TO DOs

  • Implement a SVM based classifier to classify people.
  • Implement video based face recognition.
  • add GitLab link for code.
  • Implement a DNN based classifier to classify.
  • Compare SVN with DNN. Check Speeds.
  • Basic documentation for the code.

EDIT 1

  1. SVM based classifier implemented.
  2. Video based recognition implemented.
  3. Local repository pushed to GitLab
  4. Note: The repository is 700+ MBs.

Some Working Sample.

** Since I usually get confused between these two, I tried to recognize them using this model.

twvsrt

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages