ram-ch / RealTimeFaceRecognition

Real time face detection with opencv,mtcnn,svm
8 stars 4 forks source link

Real-Time Face Recognition

This project aims at building a realtime face recognition model.The purpose is to recognize a person/persons in a natural video. The model takes in a camera feed and returns a video stream with a bounding box and a probability for all the class labels. To achieve this functionality I have used:

Files and directory structure

RealTimeFaceRecognition
|__FaceDetector.py      
|__FaceTrainer.py     
|__facenet_keras.h5    
|__SVM_classifier.sav    
|__faces_dataset_embeddings.npz   
|__faces_dataset.npz   
|__faces_dataset   
   |__train   
      |__sai_ram    
      |__donald_trump   
      |__narendra_modi   
      |__virat_kohli   
   |__val   
      |__sai_ram   
      |__donald_trump   
      |__narendra_modi   
      |__virat_kohli   

Training Data

The training data consists of 4 classes (4 persons). I have gathered 15 images per class and have compiled the training data set with a total of 60 images. The directories are named after the class labels. Apart from training data I have gathered 5 more images for validation during the training of the model. Initially, I thought of compiling a data set with thousands of images for each class, but in real-world business use cases, it is very difficult to gather such a huge number of pictures for each individual. Hence our model should be good enough, even with bare minimum number of observation for each class.

  1. sai_ram
  2. narendra_modi
  3. donald_trump
  4. virat_kohli

FaceTrainer.py

This python script builds and trains a model on the images in faces_dataset

Training Procedure:

FaceDetector.py

This file uses live web cam feed to detect and recognize the faces

Use Cases:
1. Automatic classroom attendance in educational institutions
Value addition:

More about
MTCNN: https://arxiv.org/abs/1604.02878
Keras facenet pretrained model: https://pypi.org/project/keras-facenet/
Support Vector Machines: https://www.analyticsvidhya.com/blog/2017/09/understaing-support-vector-machine-example-code/