I am trying to train a haar cascade using opencv_traincascade executable in opencv 3.1.0.
For the moment I want to do this using only one positive even though the result is inconsistent, in order to be sure that I am passing the right parameters to opencv_createsamples and opencv_traincascade.
bg.txt content:
negatives/img_04436_c1.pgm
negatives/img_04437_c1.pgm
Negatives resolution: width: 1176 height: 640
Positives resolution: width: 40 height: 70
I am using the following command parameters:
For opencv_createsamples:
./opencv_createsamples -img img_04569_c1.pgm -vec samples -bg bg.txt -maxxangle 0.1 -maxyangle 0.1 -maxzangle 0.1 -w 40 -h 70 -num 30
Info file name: (NULL)
Img file name: img_04569_c1.pgm
Vec file name: samples.vec
BG file name: bg.txt
Num: 30
BG color: 0
BG threshold: 80
Invert: FALSE
Max intensity deviation: 40
Max x angle: 0.1
Max y angle: 0.1
Max z angle: 0.1
Show samples: FALSE
Width: 40
Height: 70
Create training samples from single image applying distortions...
Open background image: negatives/img_04436_c1.pgm
Done
For opencv_traincascade:
./opencv_traincascade -data cascade -vec samples -bg bg.txt -w 40 -h 70 -numPos 30 -numStages 1 -numNeg 2
PARAMETERS:
cascadeDirName: cascade
vecFileName: samples.vec
bgFileName: bg.txt
numPos: 30
numNeg: 2
numStages: 2
precalcValBufSize[Mb] : 1024
precalcIdxBufSize[Mb] : 1024
acceptanceRatioBreakValue : -1
stageType: BOOST
featureType: HAAR
sampleWidth: 40
sampleHeight: 70
boostType: GAB
minHitRate: 0.995
maxFalseAlarmRate: 0.5
weightTrimRate: 0.95
maxDepth: 1
maxWeakCount: 100
mode: BASIC
===== TRAINING 0-stage =====
<BEGIN
POS count : consumed 28 : 28
*** Error in `./opencv_traincascade': double free or corruption (out): 0x00000000016749b0 ***
Aborted (core dumped)
My problem is the following:
I am able to create the sample.vec file.
When I run opencv_traincascade I get the following error:
*** Error in `./opencv_traincascade': double free or corruption (out): 0x0000000001e0e9b0 ***
Sometimes I also get a Segmentation Fault error.
I tried to resize the negatives to a lower resolution and I am able to generate the xml file but when I am trying to use it nothing happens. (the classifier is stucked and runs continuously without returning any rectangles)
I want to use my original negatives size.
Can anybody help me to solve this problem ?
If more details are required please leave a comment and I will update my question.