valentin
valentin

Reputation: 1123

HaarTraining with OpenCV error

I have about 15000 cropped images with the object of interest (positive samples) and 7000 negative images (non object of interest). The cropped images have a resolution of 48x96 and are placed in a folder. The .txt file containing the positive samples looks something like this : picture1.pgm 1 0 0 48 96 meaning that there is 1 positive sample in picture 1 from (0,0) to (48, 96). Likewise I have a .txt file for negative images.

The command for training is the following: c:\libraries\OpenCV2.4.1\opencv\built\bin\Debug>opencv_haartrainingd.exe -data d ata/cascade -vec data/positives.vec -bg c:/users/gheorghi/desktop/daimler/pedest rian_stereo_extracted/nonpedestrian/nonpedestrian/c0/negatives.txt -npos 15660 - nneg 7129 -nstage 14 -mem 1000 -mode ALL -w 18 -h 36 -nonsym

But at some point I always get this error :

    Parent node: 0

*** 1 cluster ***
OpenCV Error: Assertion failed (elements_read == 1) in unknown function, file C:
\libraries\OpenCV2.4.1\opencv\apps\haartraining\cvhaartraining.cpp, line 1858

How can I overcome this ??? Any help is appreciated. Many many thanks

Upvotes: 3

Views: 3453

Answers (2)

mayank
mayank

Reputation: 186

I answered the question here. It may be of some help.

The same issue was posted by many others, i used the advice given here.

Upvotes: 0

valentin
valentin

Reputation: 1123

I found that the problem can be solved in 2 ways. you can either decrease the amount of positives or increase the amount of negatives. either way it turns out that having a small positive to negative ratio helps.

Upvotes: 1

Related Questions