Ask Your Question
0

Error in train cascade, is it caused by my .vec file?

asked 2014-03-31 07:44:20 -0600

Shiloh gravatar image

updated 2014-04-11 08:16:28 -0600

Hello, this is my first time using opencv... I installed opencv version 2.4.3.. I want to make car detection... I collected positive images 1100 from video with variation size (grayscale and color), and 2035 for negative images ((grayscale and color)... I am using this command for make samples: image description

The size of .vec file just 2 kb

Then I try to training using cascade with command: image description

And I got these error, "one of arguments value is out of range" Can you tell me, is there something mistake I made during make .vec file or my cascade command is wrong?

My positive description is: image description

And this is the result of re-command training.. image description

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2014-03-31 07:56:34 -0600

Actually your vector creation already states the problem... at the end of your creation it clearly states:

info.txt(2): parse errorDone. Created 1 sample.

This actually means that you did something wrong in your info.txt file, since the creator didn't succeed in reading in the secondary image. So please print the output of your file by editing your question.

And then it is normal training won't work, since you are expecting 1100 positive samples and there is only a single one!

edit flag offensive delete link more

Comments

Do you mean my output is my positive description??

Shiloh gravatar imageShiloh ( 2014-03-31 08:00:09 -0600 )edit

Yes, like you posted! I can see the error directly. Windows allows to use spaces in names of files, like the _(1) on the second line. However, OpenCV cannot handle these strings, nor do C++ functions work well with them. You should avoid spaces in names at all times!

StevenPuttemans gravatar imageStevenPuttemans ( 2014-03-31 08:09:30 -0600 )edit

thanks sir, it's works now, I create 1098 samples.. but when I try opencv_traincascade my laptop suddenly shutdown at stage 6.. the command same like in pic above, but with precalcValBufSize and precalcIdxBufSize in 512.. and can I pause the training or just close command prompt and continue it??

Shiloh gravatar imageShiloh ( 2014-04-04 13:30:58 -0600 )edit

You are running into memory problems. Put both precalcValBufSize and precalcIdxBufSize to lets say 2048 and the problem will disappear. As to the continuing, go to your cascade folder with all the stages, remove the last stage (cause that one crashed) and just start your training command again. It will continue at the crashed stage with training. Also, do accept answers if they suited your needs!

StevenPuttemans gravatar imageStevenPuttemans ( 2014-04-07 02:30:56 -0600 )edit

Didn't precalcValBufSize and precalcIdxBufSize is related with RAM sir?? And I want ask what I must do to grouping these 20 stages xml files, and which xml file I use in opencv_performance (there's cascade.xml, params.xml, and 0-19 stages) Sorry I'm still noob in here, already done accepted your answer sir.. Thanks for helping me sir...

Shiloh gravatar imageShiloh ( 2014-04-09 13:12:54 -0600 )edit

Yes it is related with RAM, it defines how much memory can be used to store in between results and feature values. The higher the value, the faster the training off-course because less splitting of data has to be done. If you have 20 stage files and you want to combine them into a model, run the training command again but replace -numStages by 20! This will read them in and combine them, so you could stop training, make a model and test. Then you can continue training if you want to improve. The performance tool cannot read models created by the traincascade application. It has not been implemeted yet. It only works with the old models, trained by the haartraining application.

StevenPuttemans gravatar imageStevenPuttemans ( 2014-04-11 03:27:32 -0600 )edit

So I just need to re-command training again sir for test it?? Actually, I'm using -numStages 20 before sir... My friend told me, it's better result when used with haartraining rather than traincascade, is that true sir??

Shiloh gravatar imageShiloh ( 2014-04-11 07:32:01 -0600 )edit

Yes you give command on which level you want to test. And yes haartraining is a bit better, but its training time is exponentially larger!

StevenPuttemans gravatar imageStevenPuttemans ( 2014-04-11 07:53:59 -0600 )edit

I already try the training command, and I put the result pic above, it's just loaded... Am I wrong sir??

Shiloh gravatar imageShiloh ( 2014-04-11 08:17:49 -0600 )edit

nope it is not, the resulting cascade.xml file is now the stage0-19 combined. That you can use as a model for detection!

StevenPuttemans gravatar imageStevenPuttemans ( 2014-04-11 13:13:46 -0600 )edit

Question Tools

Stats

Asked: 2014-03-31 07:44:20 -0600

Seen: 1,121 times

Last updated: Apr 11 '14