Ask Your Question
0

Cascade trainer cant be trained

asked 2014-07-30 19:51:49 -0600

bexier gravatar image

updated 2014-08-24 13:32:42 -0600

Im training some images and I get this error: Train dataset for temp stage can not be filled. Branch training terminated. Cascade classifier can't be trained. Check the used training parameters.

PARAMETERS:

cascadeDirName: data vecFileName: cars.vec bgFileName: bg.txt numPos: 2050 numNeg: 4007 numStages: 35 precalcValBufSize[Mb] : 2548 precalcIdxBufSize[Mb] : 2548 stageType: BOOST featureType: HAAR sampleWidth: 48 sampleHeight: 24 boostType: GAB minHitRate: 0.995 maxFalseAlarmRate: 0.5 weightTrimRate: 0.95 maxDepth: 1 maxWeakCount: 100 mode: BASIC

Stages 0-4 are loaded

===== TRAINING 5-stage ===== <begin pos="" count="" :="" consumed="" 2050="" :="" 2073="" neg="" count="" :="" acceptanceratio="" 199="" :="" 0.0165599="" precalculation="" time:="" 79="" +----+---------+---------+="" |="" n="" |="" hr="" |="" fa="" |="" +----+---------+---------+="" |="" 1|="" 1|="" 1|="" +----+---------+---------+="" |="" 2|="" 0.999024|="" 0.763819|="" +----+---------+---------+="" |="" 3|="" 0.996585|="" 0.673367|="" +----+---------+---------+="" |="" 4|="" 0.997073|="" 0.723618|="" +----+---------+---------+="" |="" 5|="" 0.99561|="" 0.482412|="" +----+---------+---------+="" end=""> Training until now has taken 0 days 0 hours 8 minutes 37 seconds.

===== TRAINING 6-stage ===== <begin pos="" count="" :="" consumed="" 2050="" :="" 2082="" train="" dataset="" for="" temp="" stage="" can="" not="" be="" filled.="" branch="" training="" terminated.="" i've="" gotten="" this="" after="" every="" stage="" so="" far.="" i="" have="" deleted="" the="" data="" content="" as="" well.<="" p="">

I NOW have 2584 positive images 4007 negative. Any ideas of what could be the problem? Thanks in advance

edit retag flag offensive close merge delete

Comments

1

am i wrong or is the error missing ?

berak gravatar imageberak ( 2014-07-31 00:12:44 -0600 )edit
1

sorry for the delay there error! Train dataset for temp stage can not be filled. Branch training terminated. Cascade classifier can't be trained. Check the used training parameters.

bexier gravatar imagebexier ( 2014-07-31 21:12:22 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
1

answered 2014-07-31 02:28:32 -0600

I think I already discovered why this is not running. Keep in mind that OpenCV pushes the feature descriptors of each training image into memory. Keeping in mind you have over 2000 training images (pos and neg - where negatives can actually contain multiple negatives) of which you want to store a 48x24 pixel descriptor in only 256 MB of memory will absolutely not work and just crash. Try adding the memory parameters to your train_cascade command.

This will be about the memory you will need. It is still possible you will need to reserve even more! Also I have changed some of the parameters you are assigning. Keep in mind that you have to need the exact same description, so with identation! Getting a hitrate of 0.9999 is quite impossible. That model will never train or require millions of data! Be happy with 0.95 as a start! I would also add the -featureType LBP parameter. It helps training time descrease drastically and works almost as good as HAAR wavelets. And as a last remark, hoping for 14 stages to differentiate a car model is hoping for to much. I would suggest increasing it at least to lets say 30 stages.

Final command:

opencv_traincascade -data data -vec cars.vec -bg bg.txt -numStages 30 -nsplits 2 -minHitrate 0.95 -maxFalseAlarmRate 0.5 -numPos 1400 -numNeg 692 -w 48 -h 24 -precalcValBufSize 2048 -precalcIdxBufSize 2048 -featureType LBP

edit flag offensive delete link more

Comments

@steven Thanks for the reply. Sorry for the delay I couldnt log in for some reason, I just tried that command and it did not work! I am receiving the same error. I will try to tweak a few things until I get another reply.. I appreciate the responses and look forward to hearing more!!!

bexier gravatar imagebexier ( 2014-07-31 21:13:47 -0600 )edit

Okay looking at your error, change the following parameters. -numPos 1250 -numNeg 400 and see what happens.

StevenPuttemans gravatar imageStevenPuttemans ( 2014-08-01 02:04:58 -0600 )edit

still nothing! I have trained a few other things before and didnt have many problems. Thanks for the reply I did change those params but nothing happend!

bexier gravatar imagebexier ( 2014-08-01 11:48:26 -0600 )edit

Could the image color cause a problem I do have some mixed colored and black and white photos. I read another post about it and the channel could cause this error? I even added more negative images so I am at 1072 now

bexier gravatar imagebexier ( 2014-08-02 14:57:00 -0600 )edit

That should not affect the training, since each image should be read in as color and then converted to grayscale during the training process. However I know this is standard at detection time, only not 100% sure. Could you try converting them to grayscale images yourself first?

StevenPuttemans gravatar imageStevenPuttemans ( 2014-08-04 02:01:42 -0600 )edit

I will give it a try!

bexier gravatar imagebexier ( 2014-08-06 09:57:33 -0600 )edit

Still I get nothing!! I am also getting a segmentation fail 11 now!

bexier gravatar imagebexier ( 2014-08-07 13:39:38 -0600 )edit

Never had that problem, nor similar experiences... Can you take the time to update your question with every single item of your training? Make WeTransfer links for your training data, give your training commands, ... and then I can try to reconstruct your problem.

StevenPuttemans gravatar imageStevenPuttemans ( 2014-08-08 02:47:25 -0600 )edit

Hello! Thanks for all of the help. Im still not exactly sure of the problem but I converted all files to pgm files and IT WORKED. To my understanding opencv is compatible with multiple image formats. Your commands worked after I did that. Thanks for all of your help and sorry for the delay!! Hope this helps others!

bexier gravatar imagebexier ( 2014-08-21 17:40:29 -0600 )edit

Hmmm did you forget to built openCV with JPEG support? That is a possibility if you deflagged it in CMAKE gui for example...

StevenPuttemans gravatar imageStevenPuttemans ( 2014-08-22 03:58:02 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2014-07-30 19:51:49 -0600

Seen: 1,698 times

Last updated: Aug 24 '14