You are on page 1of 12

Face Detection POC

Using OpenCV and Other Freely Available Libraries


Libraries

 OpenCV
 Open source computer vision and machine learning software library.
 Dlib
 Open source C++ toolkit containing machine learning algorithms.
 OpenFace
 Implementation of face recognition with deep neural networks.
 Discounted as Linux focused build scripts and beyond scope of POC.
 May be worth revisiting in the future – quick overview on last slide.
 All Support GPU Processing using OpenCL.
Test Environment

 Test app written in C++ (Also both libraries have excellent Python support)
 Initially Used PBE as Frame Server.
 No Success – Probably Due to Colour Space or Frame Format Incompatibility.
 Created MP4 files from SynAV2 footage for processing.
Algorithms

 OpenCV Haar Cascade


 State-of-the-art in Face Detection in 2001.
 Uses a cascade of elimination based
on simple detection of thousands of
feature types.

 OpenCV DNN (Deep Neural Network)


 Uses a pre-trained model included as part of OpenCV.
 The model was trained using images available from the web, but the source is
not disclosed…
Algorithms Continued
 Dlib HoG (Histogram of Oriented Gradients)
 Extracts edge gradients from each square on a grid.
 Matches a histogram to a pre-trained pattern (provided as part of Dlib).

 Dlib MMoD (Maximum-Margin Object Detector)


 Neural net trained on images from various datasets (ImageNet, PASCAL VOC, VGG,
WIDER, Face Scrub) containing 7220 images – freely available.
Results

 Original sample code expected 300p image


 Fast (25fps) but VERY poor results from typical CCTV FOV.
 Worked well with webcam footage.
 After Further Research – Recommendation was to increased to 900p
images.
 Much better results - but much slower - around 5 fps.
 GPU reduced CPU load dramatically but did not improve the frame rate.
Results: OpenCV Haar Cascade
 Lots of false positives, doesn’t work on non-frontal images, doesn’t work with occlusion.
Results: Dlib

 HoG (Histogram of Oriented Gradients)


 Low incidence of false positives.
 However - LOTS of missed faces.
 Very sensitive to scale.

 MMoD (Maximum-Margin Object Detector)


 No success finding faces at all in my testing.
 VERY low framerate (< 1fps)
Results: Open CV DNN (Deep Learning)
 Best results by far. Handles different orientations, occlusion and scale variations.
 However only capable of 6 fps.
Results: Open CV DNN (Deep Learning)
 Second example:
Other OpenCV Functionality of Value

 Motion Detection / Background Removal.

 Face Recognition using a Deep Learning Model.

 Excellent Video File Reading/Writing Capabilities.

 General Video/Image Manipulations inc. Overlays.


Open Face
 Detects faces using OpenCV.
 Transform the face for the neural network.
 Use a deep neural network to represent the face on a 128-dimensional unit
hypersphere.

 Calculate 128-dimension distance from pre-trained faces to classify.


 Neural net has been trained to minimize distance for same person, maximize
distance for different people. (This is the technique that Apple is believed to
use)

You might also like