Ask Your Question

opencv_traincascade always halts on stage 4.i

asked 2016-10-06 05:11:47 -0500

prala123 gravatar image

While trying to train a cascade classifier opencv_traincascade process always halts at stage 4.

I have 7358 of negative samples. where i list their relative path in the negative_samples file, and I have 17600 positive samples in the positives.vec file.

opencv_traincascade -data cascade -vec samples/positives.vec -bg negative_samples -numStages 20 -precalcValBufSize 10 -precalcIdxBufSize 200 -acceptanceRatioBreakValue 0.0001 -w 50 -h 50 -mode ALL -maxWeakCount 100 -maxDepth 1 -weightTrimRate 0.95

here is the console output

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2016-10-07 03:48:13 -0500

Ok there are some major issues with your command

  • -precalcValBufSize 10 -precalcIdxBufSize 200 you do know that this will slow down the training incredibly? You are limiting the memory to a single 10 bites ... which seems plain wrong. Try setting it at default values which are 1024 at least! 1GB of memory is available on most systems these days.
  • You POS:NEG rate seems wrong to me. Normally the background has more variance then the object class. So you should use a ration of 1:2 at least.
  • The fact that it is halting is that it cannot read new negative samples it seems. Can you ensure that all paths of the file are actually readable?
edit flag offensive delete link more



Yeah trouble was exactly that my pos neg ratio was not the recommended. And some samples did not have the path correct, you are right. Now it is working, and it is on stage 7 ... yay. Thanks for the reply.

prala123 gravatar imageprala123 ( 2016-10-07 04:10:43 -0500 )edit

You are welcome.

StevenPuttemans gravatar imageStevenPuttemans ( 2016-10-07 06:08:20 -0500 )edit

Question Tools

1 follower


Asked: 2016-10-06 05:11:47 -0500

Seen: 97 times

Last updated: Oct 07 '16