File Exchange

image thumbnail

Train Cascade Object Detector

version 1.0.0.0 (6.5 KB) by Jeremy Wurbs
Example showing how to train a user-defined object detector.

8 Downloads

Updated 02 Dec 2013

View License

This function (trainClassifierExample.m) is a tutorial/example on how to create a user-defined vision.CascadeObjectDetector detector. This function uses an attached webcam to take video of a user and builds a detector on their face. From this example hopefully it is clear how to generate detectors for any general object class. Faces are used in this example since the labeling can be done autonomously using a pre-trained face detector.

The function goes through the following steps:

1) Take video which includes object of interest (the user's face).
2) Label (manually or autonomously) positive objects from the video in (1).
3) Take video which does NOT include object of interest.
4) Train classifier using trainCascadeObjectDetector.
5) Test classifier on live video.

Note: to train new classifiers you will likely have to label the positive examples by hand. For manual labeling this function uses the Cascade Training GUI, which you can download at: http://www.mathworks.com/matlabcentral/fileexchange/39627-cascade-training-gui-specify-ground-truth

Please let me know if something is not clear or does not work. Cheers!

Comments and Ratings (7)

its showing error at "CascadeTrainerGUI" when using manual mode to labelobjects even though i have downloaded the file specified by you

adam AHMED

Thank you for this helpful function .
I have a question . does Cas​cadeObject​Detector function give the same performance as Opencv "haartraing" function ???
if yes then way opencv take all that time to finish the trainning ???

i want to set centroid and x y coordinates
plz help

Faisal

Hi, Sir.
Can you tell me a method, how to create a data base for Face detection.
I want to detect faces of different people. Like facebook is doing (you upload an image, and FB tells you the name of your friend to tag in it)
is it possible with this "Train Cascade Object Detector", Please help!
Thanks.

Jeremy Wurbs

Line 4 of testClassifier.m is

if isfield(options, 'vid')

I.e. 'options' needs to exist. When trainClassifierExample.m calls testClassifier it should pass in the struct, 'options', with:

testClassifier(options)

The above is the last line of trainClassifierExample.m, please make sure that the '(options)' part is included.

please help ,I am using mac RS2012A ,there is an error on line four.
testClassifier
Error using testClassifier (line 4)
Not enough input arguments.

MATLAB Release Compatibility
Created with R2013a
Compatible with any release
Platform Compatibility
Windows macOS Linux