I'm trying to train some branch logos with haar_cascade. What I've done is, I've taken 2500 squared pictures of 500 x 500 to populate the samples for opencv_createsamples
. Then I generate them as:
opencv_createsamples -info 'logo.info' -vec '../logo.vec' -bg '../Negatives/bg.txt' -w 24 -h 24 -num 2500
in my logo.info
I've got lines which correspond to the relative path of every picture, with a 1 0 0 500 500
meaning "there's one object between (0,0) and (500, 500)"
then I train the cascade as:
opencv_traincascade -data 'cascade/' -vec '../logo.vec' -bg '../Negatives/bg.txt' -numPos 2500 -numNeg 3019 -numStages 25 -featureType LBP -w 24 -h 24
with these parameters:
PARAMETERS:
cascadeDirName: cascade/
vecFileName: ../logo.vec
bgFileName: ../Negatives/bg.txt
numPos: 2500
numNeg: 3019
numStages: 25
precalcValBufSize[Mb] : 256
precalcIdxBufSize[Mb] : 256
stageType: BOOST
featureType: LBP
sampleWidth: 24
sampleHeight: 24
boostType: GAB
minHitRate: 0.995
maxFalseAlarmRate: 0.5
weightTrimRate: 0.95
maxDepth: 1
maxWeakCount: 100
And I've got 2 kind of errors:
...
this errors uses to happen when you don't give a significant difference between your num of images and your -num
parameter. So, let's try to give less 100!!
well, when I've adjusted the parameters to not to go out from the array, I get the same type of output than images, but I get this error:
OpenCV Error: Assertion failed (tempNode->left) in write, file /tmp/buildd/opencv-2.3.1/modules/traincascade/boost.cpp, line 628 terminate called after throwing an instance of 'cv::Exception' what(): /tmp/buildd/opencv-2.3.1/modules/traincascade/boost.cpp:628: error: (-215) tempNode->left in function write
Aborted
I've tried:
-mode
parameter.What I have to do, is training obligatory with LBP (not HAAR). Do anyone have any clue?
Thank you in advance.
Uninstalling and rebuilding OpenCV solved the problem.