opencv_traincascade.exe and background file
I create 10 samples and 10 negative samples. In positive/ directory is 10 .jpg files from 01.jpg to 10.jpg and file pos.dat:
01.jpg 1 0 0 54 67
10.jpg 1 0 0 48 59
Similar in directory negative is 10 files and neg.dat :
01.jpg 1 0 0 54 67
10.jpg 1 0 0 48 59
I can create vec by:
d:\opencv\build\x86\vc10\bin\opencv_createsamples -num 10 -info positive\pos.dat -vec pos.vec -w 40 -h 40
and vec for negative:
d:\opencv\build\x86\vc10\bin\opencv_createsamples -num 10 -info negative\neg.dat -vec neg.vec -w 40 -h 40
But is error if I try opencv_traincascade.exe
d:\opencv\build\x86\vc10\bin\opencv_traincascade.exe -data dir -vec pos.vec -bg negative\neg.dat -numPos 10 -numNeg 10 -w 40 -h 40
or
d:\opencv\build\x86\vc10\bin\opencv_traincascade.exe -data dir -vec pos.vec -bg neg.vec -numPos 10 -numNeg 10 -w 40 -h 40
Is error:
Train dataset for temp stage can not be filled. Branch training terminated. Cascade classifier can't be trained. Check the used training parameters.
Is error for -bg negative\neg.dat and neg.vec, can be other?
It is quite simple, negative data doesn't need to be in a data vector but just pointed to with a negative.txt file containing all negative images!
negative.txt is the same as neg.dat where is list of negative images and rectangles like 01.jpg 1 0 0 54 67? in negative.txt pathes of images are stored with relative to negative.txt ?
OK, negative.txt contain only image names, not rectangles
My result: https://i.imgur.com/abQYlNp.jpg Error because 10 positive and 10 negative is too small, or 8 stages is too small; It seems that find negative, not positive images
it is just not possible to detect objects with variation with only 10 + qnd - training samples!
Now I has 65 positives and 10 negatives