
The key step is a CNN feature extractor that generates 128-d facial embeddings. How OpenCV’s face recognition worksįigure 1: An overview of the OpenCV face recognition pipeline. Recognize faces in images and video streamsĪll of these tasks will be accomplished with OpenCV, enabling us to obtain a “pure” OpenCV face recognition pipeline.Train a Support Vector Machine (SVM) on top of the embeddings.Compute 128-d face embeddings to quantify a face.In today’s tutorial, we’ll learn how we can apply deep learning and OpenCV together (with no other libraries other than scikit-learn) to: While we used OpenCV to facilitate face recognition, OpenCV itself was not responsible for identifying faces. face_recognition (which is an easy to use set of face recognition utilities that wraps around dlib).

Well, keep in mind that the dlib face recognition post relied on two important external libraries: You might be wondering how this tutorial is different from the one I wrote a few months back on face recognition with dlib? In today’s tutorial, you will learn how to perform face recognition using the OpenCV library. Looking for the source code to this post? Jump Right To The Downloads Section OpenCV Face Recognition Update July 2021: Added section on alternative face recognition methods to consider, including how siamese networks can be used for face recognition.To learn how to perform OpenCV face recognition, just keep reading! You can swap in your own dataset of faces of course! All you need to do is follow my directory structure in insert your own face images.Īs a bonus, I’ve also included how to label “unknown” faces that cannot be classified with sufficient confidence.

To celebrate the occasion, and show her how much her support of myself, the PyImageSearch blog, and the PyImageSearch community means to me, I decided to use OpenCV to perform face recognition on a dataset of our faces. Our wedding was over the weekend, and by the time you’re reading this blog post, we’ll be at the airport preparing to board our flight for the honeymoon. Today’s tutorial is also a special gift for my fiancée, Trisha (who is now officially my wife). To build our face recognition system, we’ll first perform face detection, extract face embeddings from each face using deep learning, train a face recognition model on the embeddings, and then finally recognize faces in both images and video streams with OpenCV.

In this tutorial, you will learn how to use OpenCV to perform face recognition.
