Problem in training HAAR classifier
When i try to start classifier training after about 1 minute i got this:
opencv_traincascaded.exe -data classifier -vec samples.vec -bg negatives.txt -numStages 20 -minHitRate 0.999 -maxFalseAlarmRate 0.5 -numPos 600 -numNeg 900 -w 40 -h 90 -mode ALL -precalcValBufSize 1024 -precalcIdxBufSize 1024
This generates the following output
PARAMETERS:
cascadeDirName: classifier
vecFileName: samples.vec
bgFileName: negatives.txt
numPos: 600
numNeg: 900
numStages: 20
precalcValBufSize[Mb] : 1024
precalcIdxBufSize[Mb] : 1024
stageType: BOOST
featureType: HAAR
sampleWidth: 40
sampleHeight: 90
boostType: GAB
minHitRate: 0.999
maxFalseAlarmRate: 0.5
weightTrimRate: 0.95
maxDepth: 1
maxWeakCount: 100
mode: ALL
===== TRAINING 0-stage =====
<BEGIN
POS count : consumed 600 : 600
NEG count : acceptanceRatio 900 : 1
Precalculation time: 90.112
+----+---------+---------+
| N | HR | FA |
+----+---------+---------+
OpenCV Error:
Assertion failed (dims <= 2 && data && (unsigned)i0 < (unsigned)size.p[0] && (unsigned)(i1 * DataType<_Tp>::channels) < (unsigned)(size.p[1] * channels()) && ((((sizeof(size_t)<<28)|0x8442211) >> ((DataType<_Tp>::depth) & ((1<< 3) - 1))*4) & 15) == elemSize1()) in cv::Mat::at, file C:\OPENCV\opencv-master\modules\core\include\opencv2/core/mat.inl.hpp, line 845
Interesting thing is that if I use this option:
-featureType LBP
then training works fine. I am trying to create a classifier for detecting cars top view. This training I started just for example, and if it will begun to work I will find more positive images to create good classifier. I used 73 positives and with help of createsamples.exe I created 600 samples (73 vec files) and merged them to create one samples.vec (4 Mb). All negative images I used are greyscale, I took them from base of negative images wich was used to create face recognizing classifier and sorted them out deleting any images with cars.
P. S. Sorry for my bad english :)
Start by adding a / to your path of the data! Secondly, I think your data vector is containing wrong information! How do you combine the 72 vector files together?
@StevenPuttemans I used mergevec.exe to combine them with cmd options:
mergevec.exe "C:\OPENCV\bin\Debug\samples.txt" samples.vec
I am wondering where you got that from, the mergevec isn't an official tool part of the opencv package ...
@StevenPuttemans I found it here: link text So, what do you advise me to use with this purpose?