Broken understainding - creating a classifier

asked 2014-08-19 16:16:40 -0500

updated 2015-11-02 22:19:50 -0500

berak gravatar image

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 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
edit retag flag offensive close merge delete


Try viewing vec file with opencv_createsamples.exe -vec samples.vec -view You can see if the samples in it are what you expect.

Netsai Chibuku gravatar imageNetsai Chibuku ( 2014-08-19 23:05:27 -0500 )edit

Have you found a solution for this? I am also getting broken text in my output xml files..

Papercut gravatar imagePapercut ( 2015-11-02 16:06:51 -0500 )edit