Machine Learning project to recognise people from an Image just like facebook.
Built with the help of dlib's state-of-the-art face recognition built with deep learning. The model has an accuracy of 99.38% on the Labeled Faces in the Wild benchmark.
-
Python 3.x
-
Numpy
-
Scipy
-
Tip: Installing dlib can be a tedious job. On macOS or Linux you may follow this link.
-
Extras:
-
OpenCV (required only in
webcam.pyfor capturing frames from the webcam) -
For using
./demo-python-files/projecting_faces.pyyou will need to install Openface.To install Openface, follow the below instructions:
$ git clone https://github.com/cmusatyalab/openface.git $ cd openface $ pip install -r requirements.txt $ sudo python setup.py install
-
- Clone this repository
git clone [email protected]:anubhavshrimal/FaceRecognition.git.
-
Make folder
training-images. -
Add images of each person you want to recognise to a folder by their name in
training-images.Example
$ mkdir training-images $ cd training-images $ mkdir Name_Of_PersonThen copy all the images of that person in
./training-images/Name_Of_Personfolder.
-
Run on cmd
python create_encodings.pyto get the encodings of the images and the labels. This will createencoded-images-data.csvandlabels.pklfiles.
Note: There has to be only one face per image otherwise encoding will be for the first face found in the image.
-
Run on cmd
python train.pyto train and save the face recognition classifier. This will createclassifier.pklfile. It will also createclassifier.pkl.bakbackup file if the classifier with that name already exists.
-
Make folder
test-imageswhich contains all the images you want to find people in.
-
Run on cmd
python predict.pyto predict the faces in each image.
- Thanks to Adam Geitgey whose blog inspired me to make this project.
- Thanks to Davis King for creating dlib and for providing the trained facial feature detection and face encoding models used in this project.
