Ask Your Question
0

Can't Generate XML file

asked 2015-11-18 16:33:52 -0600

JunjieHPU gravatar image

updated 2015-11-19 07:44:12 -0600

Hi guys,

I'm trying to train my own xml file to detect balloons for my project. Here's my arguments when using traincascade in win7:

opencv_traincascade.exe -data classifier -vec samples.vec -bg neg.txt -numStages 20 -minHitRate 0.995 -maxFalseAlarmrRate 0.5 -numPos 610 -numNeg 3000 -w 60 -h 60 -mode ALL -precalcValBufSize 256 -precalcldxBufSize 256

FYI, the size of .vec file is about 3200. Sizes are different, most of them are 60x60.

Here's my question:

  1. The program kind of stuck at stage 12 since it hasn't updated any information for more than 2 days
  2. I tried to kill the program and generate a XML file with the existing 12 stages(0-11). However, the program just got killed after it displayed: Stages 0-11 are loaded.

Hope someone could explain. Thanks a lot.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
2

answered 2015-11-19 07:48:50 -0600

The size of .vec file is about 3200. Sizes are different, most of them are 60x60.

That is actually not possible. Once you use the create samples interface, you need to specify -w and -h parameter and thus all samples are rescaled to that resolution, to ensure that all training data is equal. I am guessing you choose 60x60 pixels there also?

The program kind of stuck at stage 12 since it hasn't updated any information for more than 2 days

If you are using the latest OpenCV 2.4 or master branch then it should not get stuck. It either has a hard time solving the next stage or you still have an old buggy version. Keep in mind that if you take a basic HAAR based classifier that some models train for longer than a week! So no progress in 2 days is perfectly possible. Keep a look at the data collection (and see if that increases, even if it is single samples an hour).

I tried to kill the program and generate a XML file with the existing 12 stages(0-11). However, the program just got killed after it displayed: Stages 0-11 are loaded.

That is the expected behaviour. Normally your cascade folder should now show you a cascade.xml file which is the previous stages combined. If that did not work, it was still busy with the 11th stage and running the command with -numStages=11 should fix your problem!

edit flag offensive delete link more

Comments

Hi Steven,

  1. Yes you are right about that. I should've said that the raw pictures' size are different;

  2. My current version of OpenCV is 3.0.0; however, last night I stopped the program and re-ran the program started from stage 12, it took 11 hours to finish and now it's in stage 13 now. Isn't it weird?

  3. There is a cascade.xml file in the folder. I'm gonna try it and see how it performs.

Thank you so much Steven.

JunjieHPU gravatar imageJunjieHPU ( 2015-11-19 09:54:54 -0600 )edit

You are welcome, could you accept the answer? As to the time difference, it is non deterministic, it could be possible that stage 13 will now run for a long long time. Like you said, try seeing if the achieved model is already good enough for your application or not.

StevenPuttemans gravatar imageStevenPuttemans ( 2015-11-20 04:43:09 -0600 )edit

I tried using the xml file with 0-12 stages, and the performance was pretty bad. I wonder if balloon is a good haar feature object and gonna re-test the performance using the newer xml file. BTW Steven, is it possible to see which haar feature it uses from the xml file?

JunjieHPU gravatar imageJunjieHPU ( 2015-11-24 20:32:54 -0600 )edit

Let me suggest you to start with LBP features. They are easier and faster to calculate and train. As to the object of a balloon, the downside is that you can only use edge features because texture inside is kind of unexisting... and that shape is quite common in other objects also. As to the used HAAR feature, the newly released book OpenCV 3 Blueprints has a complete explanation of the interface as well as visualisation tools for showing which features are used inside your model, as well as the explanation of how they are inside the xml file. I am planning to release that functionality to OpenCV in the future, but for now it is accompagnied with the book.

StevenPuttemans gravatar imageStevenPuttemans ( 2015-11-25 02:25:42 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2015-11-18 16:33:52 -0600

Seen: 505 times

Last updated: Nov 19 '15