Edward Shen Edward Shen - 1 year ago 153
Java Question

What is causing opencv_traincascade.exe to crash when taking in negative 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

) by opencv_createsamples, with the params
-w 32 -h32
. Additionally, I have a text file
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
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 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, with no error message.

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?

Answer Source

It appears that updating and using OpenCV's 3.1.0's tools and libraries (from their website) fixes this issue.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download