Haar Training got stuck [closed]

asked 2015-06-17 05:24:39 -0600

Vishu gravatar image

updated 2015-06-17 22:33:19 -0600

Hey guys, I use 1000 positive images and 4000 negative images with 20 stage. It got stuck at stage 6. Can anyone help me pls...

PARAMETERS: cascadeDirName: classifier/ vecFileName: samples1.vec bgFileName: ./non-face/negative.txt numPos: 1000 numNeg: 4000 numStages: 20 precalcValBufSize[Mb] : 1024 precalcIdxBufSize[Mb] : 1024 stageType: BOOST featureType: HAAR sampleWidth: 19 sampleHeight: 19 boostType: GAB minHitRate: 0.995 maxFalseAlarmRate: 0.5 weightTrimRate: 0.95 maxDepth: 1 maxWeakCount: 100 mode: BASIC

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by sturkmen
close date 2020-12-08 07:45:43.991169

Comments

Stop using opencv_haartraining and move on to the tool that is still being supported, namely opencv_traincascade.

StevenPuttemans gravatar imageStevenPuttemans ( 2015-06-17 07:12:25 -0600 )edit
1

Please add more information

Gino Strato gravatar imageGino Strato ( 2015-06-17 07:27:49 -0600 )edit

I added all the parameters please go through it and tell me what should i change...

Vishu gravatar imageVishu ( 2015-06-17 22:38:54 -0600 )edit
1

@steven I am already using opencv_traincascade..

Vishu gravatar imageVishu ( 2015-06-17 23:34:20 -0600 )edit
1

There is nothing bad with your parameters (you could increase maxDepth, but this shouldn't be the reason you are stuck). What do you mean: "I got stuck at stage 6"? Do you get some error message? Or the training is completed at stage 6? How do you get all your positive samples? Are they artificial (i.e. obtained from just very few of them) or really 1000 different samples? Please show what is the output on the screen.

Gino Strato gravatar imageGino Strato ( 2015-06-18 02:04:17 -0600 )edit

@Vishu, than please indicate that in your title. People tend to ignore topics with haartraining as a keyphrase in it. Using HAAR wavelets it kind of depends what you consider getting stuck? Is the negative counter still rising, but with like 1-2 samples a minute? Then it is actually not stuck :) Keep in mind that complex HAAR models can train over days up to multiple weeks.

StevenPuttemans gravatar imageStevenPuttemans ( 2015-06-18 02:14:30 -0600 )edit

Also, no idea what object you are detecting, but to me sampleWidth: 19 sampleHeight: 19 seems rather small. For face detection for example they proved that going smaller than 24x24 pixels just discards to much information on the face class. This could also be your problem, your adaBoost not finding features that are discriminate enough to differ between positive and negative samples due to the small model size.

StevenPuttemans gravatar imageStevenPuttemans ( 2015-06-18 02:16:21 -0600 )edit

@Gino @steven : samples (images of FACE) are from MIT database. and At stage 6 it will go to infinity loop.i waited for 10hours and then i stopped.

Vishu gravatar imageVishu ( 2015-06-18 03:04:00 -0600 )edit
1

How many negative images have you got? If the algorithm is not able to collect 4000 negative windows from them it will run forever.

Gino Strato gravatar imageGino Strato ( 2015-06-18 07:02:17 -0600 )edit

That could indeed be the case, but normally it should throw an error that there are unsufficient negative windows? Or doesnt it do that like it does with the positive window samples?

StevenPuttemans gravatar imageStevenPuttemans ( 2015-06-18 09:28:21 -0600 )edit
1

The source code of traincascade/imagestorage.cpp in function NegReader::nextImg() doesn't provide a mechanism to throw an error in such a case. But I have to say that stage 6 is very soon to be stuck for this reason, unless there are only very very few images.

Gino Strato gravatar imageGino Strato ( 2015-06-18 15:33:32 -0600 )edit

@Gino Strato, you might be up for implementing such a check as a PR?

StevenPuttemans gravatar imageStevenPuttemans ( 2015-06-19 02:51:58 -0600 )edit
1

At the beginning of all cycles _offset.x and _offset.y are both 0. When they come back to be both 0 it means that all possible negative windows have been checked.

Gino Strato gravatar imageGino Strato ( 2015-06-19 03:25:12 -0600 )edit