Need help with training cascade classifier

asked 2019-03-02 01:42:39 -0600

UnluckyTicket gravatar image

updated 2019-03-02 02:51:47 -0600

I have annotated all of my positive images and put it into a file called "info.txt", I only want to use my own positive examples and don't want to generate artificial examples. I have tried using the following command (-num 389, the number 389 is the total positive images that I'm currently having)

opencv_createsamples -vec faces.vec -num 389 -info info.txt -w 24 -h 24

But it returned with an error, saying https://pastebin.com/FKArU9vX I have tried searching everywhere but hasn't found a solution yet.

edit retag flag offensive close merge delete

Comments

please put your error msgs into your question, not on an external bin (where it will expire)

(ssize.width > 0 && ssize.height > 0) means, your src img was empty, it probably was not read correctly.

try to put absolute file paths into your info.txt

berak gravatar imageberak ( 2019-03-02 02:32:12 -0600 )edit

You mean like this? https://imgur.com/a/M96hMip

UnluckyTicket gravatar imageUnluckyTicket ( 2019-03-02 02:50:42 -0600 )edit

Here's my info.txt file https://pastebin.com/jpyUXm5Q Okay, I will include the error message on my thread the next time.

UnluckyTicket gravatar imageUnluckyTicket ( 2019-03-02 03:01:24 -0600 )edit

^^ yea, those are relative filenames. again, try to use an absolute one, like: /complete/path/to/positive_images/12.jpg . (same for the negatives in the next step !)

and, ofc, try to check, if all of those images really exist in that place ..

berak gravatar imageberak ( 2019-03-02 03:10:37 -0600 )edit

Yup. You're right. Some of the images are missing. Do I need to add the -bg parameter like this too? opencv_createsamples -vec faces.vec -bg negatives.txt -num 389 -info info.txt -w 24 -h 24

UnluckyTicket gravatar imageUnluckyTicket ( 2019-03-02 03:59:54 -0600 )edit

https://docs.opencv.org/master/dc/d88...

Do I need to add the -bg parameter like this too?

no, background files are only needed here, if you only have a single positive image. (again, NOT the rcommended way)

but you will need the file with the background images in the next, train_cascade step.

berak gravatar imageberak ( 2019-03-02 04:22:09 -0600 )edit