Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

opencv_traincascade.exe crashes while at NEG current samples

My goal is to train a cascade to recognize a certain face of the dice.

I have 106 non-generated samples converted into a vec file (named dice1.vec) by opencv_createsamples, with the params -w 32 -h32. Additionally, I have a text file negTxt1.txt with around 420 lines referring to other dice faces (32x32 .png files) and around 600 lines referring to other arbitrary, 640x480 sized bg files.

I attempted to run opencv_traincacade.exe with the following params on a Windows computer with at 16GB of ram: tools\opencv_traincascade.exe -data positives/testclassifier -vec positives/1/dice.vec -bg positives/negTxt1.txt -numStages 20 -numPos 100 -numNeg 1000 -precalcValBufSize 2048 -precalcIdxBufSize 2048 -acceptanceRatioBreakValue .0001 -w 32 -h 32 -mode ALL

However, while consuming (for the lack of a better word) negative samples, the program will crash while attempting to consume negative samples, and the last line before crashing is NEG current samples: 427. Then the error window, "opencv_traincascade has stopped working..." appears.

I've looked at suggestions from SO and here (i.e. here, here) but the suggested fix did not seem to be helpful. Attempting to reduce -numPos to 80 does not prevent the crash, and the buffer size parameters are sufficiently large. Attempting to reduce -numNeg to < 427 works for the first stage, but crashes in the next stage, at the same point in training (when it says NEG current samples: ...) at another number.

What steps can I do prevent this crash, and successfully create a classifier?

I apologise for any missing information I may have left out.