In the past few days I've been investigating the createsamples and traincascade methods in order to generate a car cascaded classifier. Such as myself, many people find themselves not having a clue about how to get past all the errors and problems, so in this post I'll explain my procedure and reasoning as well as I can, as well as my problem.
To give a little more context, in the past I implemented myself a boosted classifier with Haar features but since the method was not cascaded it was very slow. I am, however, very well acquainted with the method behind the cascaded classification.
Problem: Car classification on images
I downloaded a dataset (set of images) that provides 550 positive windows (100w x 40h images with cars) and 500 negative windows (100w x 40h images without cars), and I intend to use this data to train the cascaded classifier.
STEP 1 - Generate the .dat files for creating samples
The createsamples application needs a .dat file with the information about the positive and negative samples. I generated two .dat files, one with positive windows and other with negative windows:
positive.dat example structure:
CarData\TrainImages\POS\pos-0.pgm 1 0 0 100 40
CarData\TrainImages\POS\pos-1.pgm 1 0 0 100 40 (and more 548 lines of this)
The number 1 indicates that there is one object in the entire image, and the next 4 integers represent the bounding box that has the object (the entire image in this example)
negative.dat example structure:
CarData\TrainImages\NEG\neg-0.pgm
CarData\TrainImages\NEG\neg-1.pgm(and more 498 lines of this)
STEP 2 - Generate .vec files
To do this I use the createsamples.exe application with the following command line:
: createsamples.exe -info path/positive.dat -vec samples.vec -bg negative.dat -w 100 -h 40 -num 550
So far so good, the samples.vec file is generated with no issue.
STEP 3 - Train the cascaded classifier
To do this I sue the traincascade application with the following command line:
: traincascade.exe -data CarDetector -vec path/samples.vec -bg path/negative.dat -numStages 15 -stageType BOOST -featureType HAAR -w 100 -h 40 -bt DAB -maxDepth 2 -mode ALL
PARAMETERS EXPLAINED:
numStages(15): means that I want my classifier will have 15 decision stages.
stageType(BOOST): each stage is a boosted classifier
featureType(HAAR): use haar features for classification. HOG and LBP also available.
w(100): detection window width
h(40): detection window height
bt(DAB): means I want to use Discrete Adaboost (rather than logitboost and others)
maxDepth(2): means each weak classifier will use 3 features for classification
-mode(ALL): I think it means it will use all variety of haar features.
ERROR
When I run the command, the program crashes immediately with no error message, so I am completely clueless as to what I am doing wrong. I'm hoping that someone experienced in this matter will identify the problem with my procedure, as this is an issue shared by many people who are trying to use this application.
Regards!