5. IF I HAVE SEEN THIS FAR…
• Most of today is from directions
and code at
https://www.pyimagesearch.com/
2018/06/25/raspberry-pi-
face-recognition/
• And
• https://www.pyimagesearch.
com/2018/06/11/
how-to-build-a-custom-face-
recognition-dataset/
6. WHAT IS THE OSS/LINUX TECH
STACK WE ARE USING TODAY
• On the pi (rasberian pi)
• Python3
• opencv
7.
8. FIRST MUST INSTALL STUFF
This assumes that you have a real computer with a gpu to do training…
And a pi to run the model on (optional)
python3 -m pip install dlib face_recognition imutils opencv-contrib-python
You may also need cmake (apt-get install cmake)
(note in this case we are being explicit what version of python we are getting,
python 2 is dead, long live python)
9. LETS BUILD A DATASET
• In order to train our model we need photos first, there are several ways to
get this, facebook, bing image search or in our case lets just take some
snapshots
• https://www.pyimagesearch.com/2018/06/11/how-to-build-a-custom-face-
recognition-dataset/
• python3 build_face_dataset.py --cascade
haarcascade_frontalface_default.xml --output dataset/andy
12. NOW THAT WE HAVE DATA-–LETS ENCODE
• python3 encode_faces.py --dataset dataset --encodings encodings.pickle --
detection-method hog (if on pi)
• python3 encode_faces.py --dataset dataset --encodings encodings.pickle --
detection-method cnn (on a real computer)
• Especially if you have an underpowered laptop, this could take a bit!
13. AFTER TRAINING TRANSFER TO THE PI
• After the training finishes transfer the pickle file and the code we want to run
to the pi and run the recognition code.
• python3 pi_face_recognition.py --cascade
haarcascade_frontalface_default.xml --encodings encodings.pickle