I'm trying to train a cascade database with 41 positive images and 500 negative images (as a trail) Here are my steps
pos.info -
pos/pos-001.pgm 1 0 0 100 40
pos/pos-002.pgm 1 0 0 100 40
pos/pos-003.pgm 1 0 0 100 40
so on till 41
neg.txt -
neg/neg-001.pgm
neg/neg-002.pgm
so on till 500
All images are 100x40
all files are on my ubuntu Desktop (even the data folder with no data inside)
To create the vector file
opencv_createsamples -info pos.info -num 40 -w 48 -h 24 -vec pos.vec
To train the database -
opencv_traincascade -data data -vec pos.vec -bg bg.txt -numPos 30 -numNeg 500 -numStages 10 -w 48 -h 24 -featureType LBP
Version OpenCV - 2.4.9.1
Here is the copy from my terminal -
--Error-- rojitha@Rojitha:~/Desktop$ opencv_createsamples -info pos.info -num 41 -w 48 -h 24 -vec pos.vec
Info file name: pos.info Img file name: (NULL) Vec file name: pos.vec BG file name: (NULL) Num: 41 BG color: 0 BG threshold: 80 Invert: FALSE Max intensity deviation: 40 Max x angle: 1.1 Max y angle: 1.1 Max z angle: 0.5 Show samples: FALSE Width: 48 Height: 24 Create training samples from images collection... Done. Created 41 samples
rojitha@Rojitha:~/Desktop$ opencv_traincascade -data data -vec pos.vec -bg bg.txt -numPos 30 -numNeg 500 -numStages 10 -w 48 -h 24 -featureType LBP
PARAMETERS: cascadeDirName: data vecFileName: pos.vec bgFileName: bg.txt numPos: 30 numNeg: 500 numStages: 10 precalcValBufSize[Mb] : 256 precalcIdxBufSize[Mb] : 256 stageType: BOOST featureType: LBP sampleWidth: 48 sampleHeight: 24 boostType: GAB minHitRate: 0.995 maxFalseAlarmRate: 0.5 weightTrimRate: 0.95 maxDepth: 1 maxWeakCount: 100
===== TRAINING 0-stage =====
BEGIN POS count : consumed 30 : 30 Train dataset for temp stage can not be filled. Branch training terminated. Cascade classifier can't be trained. Check the used training parameters.