opencv command config and error after stages

asked 2014-08-21 18:01:56 -0500

bexier gravatar image

updated 2014-08-22 01:20:15 -0500

berak gravatar image

Hello, I am trying to first find a command that will be the most effective on new Mac Pro, it has a 2.7gh 12 core processing unit and 64gb of ram. This purpose of this computer is for this training, so what would be the best training parameters to use to get a good sized training executed. Also when I use the command below it crashes and sends an error after every stage. I am a little new to opencv.

opencv_traincascade -data data -vec cars.vec -bg bg.txt -numStages 30 -nsplits 2 -minHitrate 0.95 -maxFalseAlarmRate 0.5 -numPos 2000 -numNeg 4007 -w 48 -h 24 -precalcValBufSize 2548 -precalcIdxBufSize 2548

ERROR: After Each stage ===== TRAINING 5-stage ===== <begin pos="" count="" :="" consumed="" 2000="" :="" 2021="" train="" dataset="" for="" temp="" stage="" can="" not="" be="" filled.="" branch="" training="" terminated.<="" p="">

I have 2586 pgm positive and 4007 pgm negative. I've double checked files and folders everything seem good!

So if I could get an explanation of the error if possible and an efficient training parameter help I would really appreciate it!! I want the best training I can get which is why I didn't use LPB, I heard Haar was better. If any extra info is needed let me know. Thanks in advance!

edit retag flag offensive close merge delete

Comments

It seems like opencv_traincascade is not finding negative samples.

Are you using the 64-bit OpenCV? You are allocating two 2.5GB buffers, 32-bit OpenCV cannot address such buffers. What happens if you train without using -precalcValBufSize or -precalcIdxBufSize?

If you train a much smaller classifier first (say 10 positive and negative images), does it train without errors?

Netsai Chibuku gravatar imageNetsai Chibuku ( 2014-08-29 02:59:08 -0500 )edit

Thanks for your response. I ended up cutting positives down to 2200 and negatives to 2000 and got it to work for awhile now it says i need more samples for the next stage.

bexier gravatar imagebexier ( 2014-08-30 11:36:05 -0500 )edit
1

Does it say "Cannot get new positive sample"? If so this answer may help you: http://code.opencv.org/issues/1834 See the last answer by Maria Dimashova. You already know that -numPos parameter should be less than total number of positives in vec file. But you may have to reduce -numPos parameter even more (or, add more positive samples to vec file and keep -numPos the same). Because the actual number of extra samples you need cannot be predicted easily.

Netsai Chibuku gravatar imageNetsai Chibuku ( 2014-08-31 18:26:50 -0500 )edit

Thanks I will look into it now!

bexier gravatar imagebexier ( 2014-09-03 10:42:49 -0500 )edit