Create a fast real-time face recognition app with a few lines of Python code.
face_taker.py
- Take pictures using the
face_taker.py
script. After you enter the user name, the script will save 30 images of your face in theimages
folder andnames.json
file with association between ID number and user name. The ID number represents a single face. Note: Make sure your face is centered. The window will collapse when all the 30 pictures are taken.
face_train.py
- The
face_tain.py
script will train a model to recognize all the faces from the 30 images taken usingface_taker.py
and save the training output in thetrainer.yml
file.
face_recognizer.py
- The
face_recognizer.py
is the main script. The program will recognize the face according to the ID. i.e., If Joe has an ID = 1, his name should appear in the dictionary ofnames.json
as attribute 1 like such:
{
"1": "Joe"
}
Requirements:
pip install opencv-python
pip install opencv-contrib-python --upgrade
orpip install opencv-contrib-python
pip install pillow