opencv_traincascade.exe and background file

asked 2014-06-11 08:06:11 -0600

Borneq gravatar image

updated 2014-06-11 08:10:28 -0600

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?

edit retag flag offensive close merge delete

Comments

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!

StevenPuttemans gravatar imageStevenPuttemans ( 2014-06-11 08:36:18 -0600 )edit

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 ?

Borneq gravatar imageBorneq ( 2014-06-11 08:49:13 -0600 )edit

OK, negative.txt contain only image names, not rectangles

Borneq gravatar imageBorneq ( 2014-06-11 09:13:17 -0600 )edit

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

Borneq gravatar imageBorneq ( 2014-06-11 09:34:39 -0600 )edit

it is just not possible to detect objects with variation with only 10 + qnd - training samples!

StevenPuttemans gravatar imageStevenPuttemans ( 2014-06-11 12:08:59 -0600 )edit

Now I has 65 positives and 10 negatives

Borneq gravatar imageBorneq ( 2014-06-11 12:19:41 -0600 )edit