Face detection with OpenCV and deep learning (1/17)
January 21, 2019
This is the first project out of 17 which I am planning to develop in a series with the help of a course. And I promise to try my level best to complete each one of them on my pace.
Recently I tried to build a Face Detection system. That was a frontal-face detection and was built using the haarcascade_frontalface_default.xml classifier already available in the OpenCV library. That was a 1O1 approach to face detection using OpenCV.
Expanding to the same use-case. This time, I tried to achieve fast and accurate face detection using a pre-trained deep learning based face detector model coming with the library. This is available in dnn module which was added to OpenCV in its August 2017 release(OpenCV 3.3).
It requires two sets of files while using OpenCV "dnn" module with Caffe models. These are :
- The .prototxt file(s) which define the model architecture (i.e., the layers themselves)
- The .caffemodel file which contains the weights for the actual layers
So, this time, the face detection is not limited to frontal faced images and videos. It covers all orientations of the face with a degree of probability of detection indicated alongside.
Let's have a look at the results:
Face detection in videos can also be done using the same dnn module with little modifications in the above approach. You can check the code for reference here.
That's all for now. :)