
Face Recognition and Face Detection series in Python
- Detecting Faces with 20 lines in Python
- Face Recognition with 20 lines in Python
- Detecting Facial Features with 20 lines in Python
- Facial Features and Face Recognition with 20 lines in Python
- Performance improvements with code
- Resize the camera input with OpenCV
- Working with Haar Cascades and OpenCV
- Detect and blur faces 😁 using haar cascades
- Detect and blur faces 😁 using DNN
Hi!
Yesterday I explained how to write a couple of lines in Python to perform live face detection in a webcam feed [Post]. Check the resources section to find more about the tools I’m using.

Today, I’ll add some more code to perform face recognition. And as usual, I’ll work with my kids to test this out. I’ll start adding 2 face encodings for Valentino and myself. The code is simple enough, and I use a simple 300×300 head-shot photo to train and get the face encoding.
The previous function returns an set of arrays with the face encodings and the face names. In the complete file, I’ll use this to analyze the camera frame (line 31) and later to check the matches for faces (lines 34 * 36)
Last lines are cosmetic to mostly draw the frames for the detected faces, and show the names.
The complete project is available here https://github.com/elbruno/Blog/tree/master/20190521%20Python%20FaceRecognition
Happy Coding!
Greetings @ Burlington
El Bruno
Resources
- Anaconda Distribution, https://www.anaconda.com/distribution/
- Visual Studio Code, https://code.visualstudio.com/
- Adam Geitgey, https://github.com/ageitgey/face_recognition
My Posts
5 comments