Team Edge facial recognition project using Open CV. This project is based on the Instructables tutorial by Marcelo Rovai - Real-Time Face Recognition: An End-to-End Project
All projects are built using OpenCV and other libraries.
This project consists of 4 main Python scripts.
- face_detector.py : The basic project that tracks faces and places a frame during a live stream.
- face_recognizer.py : Used to capture different faces. Places 30 images in the faces_dataset given one numerical index by Terminal input (0,1,2 ...)
- face_training.py : Once there are faces in the faces_dataset folder, Run this app to Train your model. This is done once you have captured all the faces you wish to recognize. If you add more users in step 2, you must retrain by running this script again.
- face_recognition_final.py : The final face recognizer app that will place a name label based on the face, along with a confidence score. You must define the list of users before running, as well as have the trainer create the .yaml file in step 3.
Install Open CV.
$ pip3 install opencv-contrib-python==4.1.0.25
$ sudo apt-get install -y libatlas-base-dev libhdf5-dev libhdf5-serial-dev libjasper-dev libqtgui4 libqt4-test
Follow this page for more details.
Install Pillow
$ pip3 install pillow
After cloning, create two directories in the main directory:
$ mkdir trainer
$ mkdir faces_dataset
The trainer folder will hold the .yaml file which is the trained faces model. The faces_dataset will store the captured grayscale images generated by face_recognizer.py.
Uncomment the line that flips the image vertically if your camera needs this correction on all files. Update the list of persons in face_recognition_final.py to match the user IDs you entered when face_recognizer.py was run.
Have fun!