Help training Opencv

Asked

Viewed 274 times

1

In a process of creating a haarcascade, I performed the procedures according to the tutorials of the Opencv library and arrived at the result of a vector with the number of 70 positive images named positive vec.. The vector is being generated correctly, because executing the following command, the vector images are shown:

opencv_createsamples -vec positivos.vec -show -w 20 -h 20

inserir a descrição da imagem aqui

My problem is in part of the training command, when executing the following command:

opencv_traincascade -data data -vec positivos.vec -bg negativos.dat -numPos 70 -numNeg 35 -numStages 10 -minHitRate 0.8 -w 20 -h 20

inserir a descrição da imagem aqui

My negative.dat file is as in the following way:

negativos/img1.jpg

negativos/img2.jpg

negativos/img3.jpg

negativos/img4.jpg

...

negativos/img1000.jpg

What would be the problem with the training command? Few images? Something not correctly added? How to proceed?

Note: I am using Windows 10 64bits.

  • How about showing the original error msg instead of images? You wouldn’t believe how bad it looks on some systems.

  • It is that the error message appears directly in Prompt, I run the command there and end up giving error along with the warning that the program stopped working. The main error that appears at the prompt is: Opencv Error: Bad argument (Can not get new Positive sample. The Most possible Reason is insufficient Count of samples in Given vec-file.

1 answer

-1

Use twice the negative images for the positive images example 40 positive to 80 negative do not put less than twice the positive in the negative. That should fix that mistake.

Another hint in featureType configure for LBP and not HAAR is a great combination this to train images. This parameter indicates the type of algorithm to be processed LBP and the most advanced HAAR.

I hope I’ve helped!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.