Skip to content

It is a Machine Learning project that recognizes faces of multiple people using Google facenet and SVM algorithm

Notifications You must be signed in to change notification settings

themechanicalcoder/Real-Time-Face-Recognition

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 

Repository files navigation

Real-Time-Face-Recognition

It is a Machine Learning project that recognizes faces of multiple people using Google facenet and SVM algorithm to predict the face in real time

Input Image

gourav

Output Image

Gourav1

Dependencies

Python 3
Tensorflow
Keras
Open-cv
Scikit Learn
Numpy
Matplotlib

Algorithm

  1. First the face is detected and extracted from the training images of all classes using opencv haar-cascade(face_preprocessing.py)
  2. Then the images are converted to a particular size and fed into the Google facenet which returns a 128 length vector per image(via triplet loss) and the labels are encoded into one-hot arrays.
  3. The list of preprocessed images and one-hot arrays are then fed into SVM (face_classification.py)
  4. The model is then tested for accuracy (test.py)
  5. For live prediction using webcam input image is taken from open-cv and it is again converted into 128 length vector using steps 1 to 3

How to use this repository

All the codes are in the "src" directory.
Make the following directory structure
Dataset->data->train->training classes with images of respective classes
Dataset->data->val->test classes with images of respective classes
New Doc 2019-06-15 19 18 29

if __name__ == "__main__": 
   
   trainX, trainy = load_dataset('D:\\Dataset\\data\\train')
   print(trainX.shape, trainy.shape)
   
   # load test dataset
   testX, testy = load_dataset('D:\\Dataset\\data\\val')

and put the directory address in the load_dataset() in above code in face_preprocessing.py
Then run embeddings.py->face_classification.py->test.y (for getting the accuracy)
For usign webcam you can run the file real_time_recognizer.py

The model achieved an accuracy of around 82% which is quite good as there were a total of around 50 images per class
References-Google Facenet model

About

It is a Machine Learning project that recognizes faces of multiple people using Google facenet and SVM algorithm

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages