Ask Your Question
0

opencv_traincascade.exe crashes while at NEG current samples

asked 2016-05-29 14:48:57 -0600

xEden gravatar image

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.

edit retag flag offensive close merge delete

Comments

Actually, this is the kind of bullshit errors that windows tried to throw up. A process that is slowly progressing can be seen as a crash ... while it actually is not crashing at all but just slowly calculating ... one of the main reasons why I moved on to Linux for training models. Just a question: I suppose you are running OpenCV in Debug build?

StevenPuttemans gravatar imageStevenPuttemans ( 2016-05-30 04:16:51 -0600 )edit

After looking at your suggestion and digging around some more, it appears that the older versions (<3.0) have this issue, but not 3.0. If you want, you can post that as the answer, or you can leave it to me. Additionally, it appears that some cascade data, when detecting dice while livestreaming, seems to be slower than others. Should I post that as another question after doing some research, or do you have an immediate answer and solution for that? Thanks again.

xEden gravatar imagexEden ( 2016-05-30 20:38:26 -0600 )edit

Even 3.0 is an old version, if you want the latest bugfree version, then use the current master branch of OpenCV. It contains all fixes supplied since the switch to the new interface. As to it being slow or faster, that all depends on how complex your model is and with what optimization parameters OpenCV was built on your system.

StevenPuttemans gravatar imageStevenPuttemans ( 2016-06-01 03:47:52 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
1

answered 2016-06-02 12:59:29 -0600

xEden gravatar image

After StevenPuttemans' kind suggestion, it appears that updating and using OpenCV's 3.1.0's tools and libraries (from their website) fixes this issue.

Again, thanks again to StevenPuttemans.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2016-05-29 14:48:04 -0600

Seen: 703 times

Last updated: Jun 02 '16