# Train a Cascade Object Detector in MATLAB

I am trying to train a cascade object detector in MATLAB using the built in functionality from the Computer Vision Toolbox.

I’ve taken 500 photo’s of the sole of my shoe. Every photo is taken from the same angle, so there is very little shifting in rotation and scaling from all of the images.

For the negative images I am using 500 photo’s of the background that is behind the shoe in the positive images.

The reason I am using the background as the negative photo’s is to train the classifier to overlook the background.

After I train the cascade classifier with these positive and negative images and apply it to another image of my shoe (taken from the same angle as one of the positive images) the detector does not detect the shoe!

What am I doing wrong?

Here are two of the photo's I am using for the negative and positive image (with bounding box shown).

Here is the code I have written that performs this task:

% Load Positive Images with Bounding Boxes from the "Training Image Labeler App"
data = positiveInstances;

negativeFolder = fullfile('C:\shoes\neg');

% Train Detector

% Use Detector