Build a cascade of boosted classifiers for vehicle detection
This document describes how to train a classifier for vehicle
detection. We show the steps of training a classifier and testing it.
We use tools in OpenCV (beta 5). The three programs are "createsamples.exe",
"haartraining.exe", "performance.exe".
Configuration
The window size for both training and testing is 32x32.
The working dictionary is:
D:/JyunFan/Working
Step 1 - Preparation
Please see the page "Setup a database with LabelMe."
Positive Samples
We use CBCL car database
as our positive samples because it is cropped and aligned. The database
contains 516 car images in frontal and rear views. We use center 64x64
pixels of each image for training. We manually create a text file
"positives.txt" which contains image filenames and positions of cars.
The file looks like:
car_0001.png 1 32 32 64 64
car_0002.png 1 32 32 64 64
...
car_0516.png 1 32 32 64 64
The training program "haartraining" need a file that contains all
positive samples and each image is a vector. We can feed the
"positives.txt" into "createsamples" to create the file"positives.vec".
createsamples -info D:/JyunFan/Working/positive.txt -vec D:/JyunFan/Working/positives.vec -num 516 -w 32 -h 32
But creating positive samples by this way will only produce 516 samples
(the same with the number of the input images). Indeed "createsamples"
has another function that distorts images slightly (rotation,
illumination) to produce more samples.
D:\JyunFan\VisionImage\CarTrain>performance -data ..\cbcltrain -info test\tests.
txt -w 32 -h 32 -sf 1.05 -maxSizeDiff 1.3
D:\JyunFan\VisionImage>haartraining -data CBCLTrain\ -vec CBCLTrain\positives.ve
c -bg CarTrain\negatives.txt -npos 516 -nneg 1032 -w 32 -h 32 -mem 512 -minhitra
te 0.99 -maxfalsealarm 0.4 -nstages 15
2006.6.15