Ask Your Question

itymoneus's profile - activity

2014-08-19 16:16:40 -0600 asked a question Broken understainding - creating a classifier

My python object detection code is working fine, but only with the sample classifiers (OpenCV 2.4.9). But my own classifier (actually the first I am trying to make) does not find anything at all. I suspect that my understanding of the training especially the generation of the vec file is broken... (see script below, which is based on http://docs.opencv.org/doc/user_guide/ug_traincascade.html and generates a cascade.xml without any error messages)

Ideas would be appreciated!

REM 1. Step - distort all positive samples / add negatives as background etc.
FOR %%c in (..\positive_samples_cropped\*) DO opencv_createsamples.exe -img %%c  -num 35 -bg ..\negative_samples.txt -info tmp.txt -maxxangle 0.6 -maxyangle 0 -maxzangle 0.3 -maxidev 100 -bgcolor 0 -bgthresh 0 && type tmp.txt && type tmp.txt >> .\descriptor.txt

REM 2. Step - join all distorted pictures together into vec for training
opencv_createsamples.exe -info .\descriptor.txt -vec samples.vec -w 20 -h 20

REM 3. Step - Training !
mkdir classifier
del classifier\*
opencv_traincascade.exe -data classifier -vec samples.vec -bg ..\negative_samples.txt -numStages 20 -minHitRate 0.99 -maxFalseAlarmRate 0.5 -numPos 500  -numNeg 600 -w 20 -h 20 -mode ALL -precalcValBufSize 1024  -precalcIdxBufSize 1024