Ask Your Question
0

Haar Training hang after few stages.

asked 2013-04-01 00:31:02 -0600

neerat.sharma gravatar image

I am doing haar training for object detection, first 10 stages goes very fast after 10th stages. it will hangs more than 9 days.i am using i7-12gb-ram.still slow. Pos samples 494 and negative samples 2500.

MY steps for haar training :-

1. Create training samples from one { createsamples -img face.png -num 10 -bg negatives.dat -vec samples.vec -maxxangle 0.6 -maxyangle 0 -maxzangle 0.3 -maxidev 100 -bgcolor 0 -bgthresh 0 -w 20 -h 20}

2*Create training samples from some* {opencv_createsamples -info samples.dat -vec samples.vec -w 20 -h 20]

3. Create test samples {opencv_createsamples -img face.png -num 10 -bg negatives.dat -info test.dat -maxxangle 0.6 -maxyangle 0 -maxzangle 0.3 -maxidev 100 -bgcolor 0 -bgthresh 0}

4. Show images {opencv_createsamples -vec samples.vec -w 20 -h 20}

5 haar training {Opencv_haartraining -data haarcascade -vec samples.vec -bg negatives.dat -nstages 20 -nsplits 2 -minhitrate 0.999 -maxfalsealarm 0.5 -npos 7000 -nneg 3019 -w 20 -h 20 -nonsym -mem 512 -mode ALL}

Tree Classifier Stage +---+---+---+---+---+---+---+---+---+---+---+ | 0| 1| 2| 3| 4| 5| 6| 7| 8| 9| 10| +---+---+---+---+---+---+---+---+---+-- 0---1---2---3---4---5---6---7---8---9--10 Parent node: 10

* 1 cluster * POS: 90 90 1.000000

And other one like this aftr 16th stage

137531| 77%|-| 0.999988| 1.000000| 1.000000| 0.707736| +----+----+-+---------+---------+---------+---------+ |137532| 70%|-|-0.000012| 1.000000| 1.000000| 0.712034| +----+----+-+---------+---------+---------+---------+ |137533| 77%|-| 0.999988| 1.000000| 1.000000| 0.707736| +----+----+-+---------+---------+---------+---------+ |137534| 70%|-|-0.000012| 1.000000| 1.000000| 0.712034| +----+----+-+---------+---------+---------+---------+ |137535| 77%|-| 0.999988| 1.000000| 1.000000| 0.707736| +----+----+-+---------+---------+---------+---------+ |137536| 70%|-|-0.000012| 1.000000| 1.000000| 0.712034| +----+----+-+---------+---------+---------+---------+ |137537| 77%|-| 0.999988| 1.000000| 1.000000| 0.707736| +----+----+-+---------+---------+---------+---------+

Kindly help what will i do

edit retag flag offensive close merge delete

Comments

1

I suggest you to use opencv_trainingcascade instead of opencv_haartraining. With TBB enabled, the training will run faster with the multithreading enabled.

icedecker gravatar imageicedecker ( 2013-04-01 06:38:39 -0600 )edit

tell me some other thing help.....and methods is right or wrong

neerat.sharma gravatar imageneerat.sharma ( 2013-04-02 05:05:56 -0600 )edit

It is wrong to state that LBP will go much faster in training due to multithreading. It is only due to the fact it are integer operations in stead of floating point operations. There is only a very small amount of processing done multithreaded due too how the cascade boosting algorithm actually works.

StevenPuttemans gravatar imageStevenPuttemans ( 2013-04-13 05:28:03 -0600 )edit

2 answers

Sort by ยป oldest newest most voted
2

answered 2013-04-12 22:28:26 -0600

I have successfully trained several LBP cascades for hand pose determination and often during training I would experience the "hanging" you describe. My guess is that the discrimination power you are demanding from the cascade at each stage cannot be achieved given the method and your data. I would tweak my input parameters until success. This probably means you should try lowering you minhitrate and nstages. Also, the conventional wisdom states that you should have significantly more negatives than positives. The relative sizes of your training set examples might be untenable. Hope that helps.

edit flag offensive delete link more

Comments

1

I agree to that. You get stuck because he cannot find negatives and positives anymore at a certain stage that are wrongly classified. You should tweak parameters until you can get good results.

StevenPuttemans gravatar imageStevenPuttemans ( 2013-04-13 05:29:42 -0600 )edit

Thanks Lee....is there any properly explained tutorial for train cascade.

neerat.sharma gravatar imageneerat.sharma ( 2013-04-14 22:52:34 -0600 )edit
1

Thanks Steven.....but can you provided some tutorial with example.This one i studied.

neerat.sharma gravatar imageneerat.sharma ( 2013-04-15 02:59:19 -0600 )edit
1

This is the best one around, it goes through all details. Most others on the net discuss the old interface, which is not similar.

StevenPuttemans gravatar imageStevenPuttemans ( 2013-04-15 08:15:11 -0600 )edit
3

http://note.sonots.com/SciSoftware/haartraining.html

That is the one that I found most helpful. It is a little dated, so things might not match up perfectly with the newer releases, but it will make everything clear. The page Steven linked to is also very helpful.

Der Luftmensch gravatar imageDer Luftmensch ( 2013-04-15 09:19:10 -0600 )edit
1

Thanks Lee & Steven

neerat.sharma gravatar imageneerat.sharma ( 2013-04-15 22:45:03 -0600 )edit

i did all but still hangs evrey thing is acc to the tuto. what to dio

neerat.sharma gravatar imageneerat.sharma ( 2013-05-08 07:18:10 -0600 )edit

If it hangs, it is probably due to your negative set not being diverse enough or you provided not enough training data!

StevenPuttemans gravatar imageStevenPuttemans ( 2013-05-08 09:03:05 -0600 )edit

any other parameter which i will check

neerat.sharma gravatar imageneerat.sharma ( 2013-05-14 01:10:12 -0600 )edit
-1

answered 2016-10-04 12:07:36 -0600

Try using my Cascade Trainer GUI for a simple and straightforward tool for training Haar and LBP classifiers. It also helps you skip all the fuss about samples and stuff.

http://amin-ahmadi.com/cascade-traine...

edit flag offensive delete link more

Comments

Please try to avoid reviving old topics, just for the sake of promoting your tool. There are enough active topics on this subject to do so, and other ways than a Q&A to promote your work. Why not work at integrating a visual training tool into OpenCV repo?

StevenPuttemans gravatar imageStevenPuttemans ( 2016-10-05 04:07:36 -0600 )edit

OK Steven, I'll try that. Where should I start? By the way you should also try my tool. I've been using it for a long time but just recently decided to share it with the community.

amahta gravatar imageamahta ( 2016-10-05 06:13:51 -0600 )edit

Nah I avoid using tools for stuff like training models. The advantage of knowing all the specifics (due to working on this matter for the last 5 years) is that through command line working on this goes very fast. But for starters I guess this is indeed a good place to start. Can you supply the source code on your page so I can try to build it myself on Ubuntu16.04?

StevenPuttemans gravatar imageStevenPuttemans ( 2016-10-05 06:32:14 -0600 )edit
1

Excuse me if I don't agree with you on the command line speed part. Cascade Trainer GUI actually uses that same command line tools (opencv_createsamples and opencv_traincascade). With the help of it you just skip playing genius by typing lots and lots of commands. In any case, I'll share the source code in its official page very soon.

amahta gravatar imageamahta ( 2016-10-12 17:48:29 -0600 )edit

You do not have to agree ^_^ and well, repeating commands is overrated. I got a gist list filled with commands so it is just copy pasting for me xD

StevenPuttemans gravatar imageStevenPuttemans ( 2016-10-13 04:44:37 -0600 )edit
1

I'm sure you're a pro ;) , but not everyone is.

amahta gravatar imageamahta ( 2016-10-13 13:53:18 -0600 )edit

Ah well I would not call myself a pro, just a frequent user ;)

StevenPuttemans gravatar imageStevenPuttemans ( 2016-10-14 03:28:16 -0600 )edit

Question Tools

1 follower

Stats

Asked: 2013-04-01 00:31:02 -0600

Seen: 3,641 times

Last updated: Oct 04 '16