Wednesday, August 3, 2011

Template matching using HOG Features

Last time we talked about using Histogram of Orientation Gradient features to describe shape. Today we will show you the results of using the HOG features to detect shapes in images.

First we need to train our images by placing bounding boxes for positive labels and negative labels.
In this example, the "petiole" of an insect is a positive label (green bounding box), and the negative labels (red bounding box) are random patches that give the model an idea of what is "not a petiole."

We calculate the HOG feature at each window:


Then, we train the positive and negative labels using a Support Vector Machine, which is a binary classifier (eg. is it X or is it Y?) In our case we care about whether it is a petiole or not a petiole.

We scan through the image using a brute-force sliding window approach, calculating the HOG features as we go. We keep track of the window with the best score, and return that as our match.

Successful petiole matches


We also require the score to be high enough, in the case that there is no good match.
Successfully identified lack of petiole

 
Incorrectly identified petiole due to lighting

1 comment: