Project 5 / Face Detection with a Sliding Window

My facial detector applied to an image of a former professor!

Facial detection is one of the most common examples of computer vision that we ecounter in our daily lives. It is a common feature on digital cameras, cell phones, and social media applications. For this project, I implemented a face detector based on the detector from the Dalal and Triggs publication from 2005. This implementation focused on implementing a Histogram of Gradients that is roughly modeled after a SIFT descriptor. Creating this facial detection pipeline involved the following steps

  1. Getting positive features, and random negative features from training data
  2. Training a linear classifier using this training data
  3. Running my trained detector on test sets of images

Getting positive and negative features

We were provided with a quite large data set from which to get training data for this project.

For positive features, I took examples from the Caltech Web Faces project that comprised of 6,713 cropped 36 x 36 faces.

The negative features were randomly selected from a small database of scenes from Wu et al. and the SUN scene database. These provided hard negatives, as most of the images were of scenery and contained no faces.

Training a linear classifier

For this project we used a Support Vector Machine as a linear classifier for our image data, using our positive and negative features that were collected in step one. I set a low bias value of 0.000001 as I noticed while experimenting that lower bias values allowed my classifier to perform better.

Running my trained detector on test images

This is when the real fun began, and the results of my work became more apparent. After training my classifier, I was able to run it using a sliding window on the test set of images. This sliding window allowed the classifier to look at specific portions of the image at multiple scales to see if a face was present in that square.

Results

After training my detector, I was able to create the following Histogram of Gradients to detect a face.

Face template HoG visualization for my implementation.

Precision Recall curve for my implementation.

The following table contains the results of my face detector when run with different confidence thresholds of what was and what wasn't a face. As you can see, the higher the confidence threshold, the more likely the detector was to filter out false positives.

Confidence Threshold: 0.25

Confidence Threshold: 0.5

Confidence Threshold: 0.75