How to train correctly a cascade

asked 2016-04-14 13:54:21 -0600

rockbass2560 gravatar image

updated 2016-04-16 17:20:19 -0600

Hi

I've been triying of training a cascade in OpenCV to identify mouths using LBP.

I cut the mouths of 10 images facial. The images look like as this:

image description

I decided to create 200 samples of each image and finally combine them using a python script.

My command line used in each image it is the next:

opencv_createsamples -img imgPositive\10.jpg -bg imgNegative\bg.dat -vec vecs\vec10.vec -w 20 -h 35 -num 200

That step I complete it perfectly. My next step is running the traincascade. However, I got the next error:

Train dataset for temp stage can not be filled. Branch training terminated. Cascade classifier can't be trained. Check the used training parameters

The command line used for that step is:

opencv_traincascade -data img/ -vec vecs/20x35.vec -bg imgNegative\bg.dat -numPos 1400 -numNeg 200 -numStages 12 -featureType LBP -w 20 -h 35

I don't know I can do to fix it. I reviewed the official documentation several times. I want to know that information you need for helping me.

Thanks.

ANSWER: I NEED TO INCREASE AMOUNT OF SAMPLES NEGATIVE AND POSITIVE. You need approximately of corpus of images 50% for positive samples, 30% for negatives and the rest for testing.

edit retag flag offensive close merge delete

Comments

1

I suggest you have a look at this thread (and all the comments associated!). You could also look for other questions (and their answers) on this forum, which provide a lot of tricks to help. If none of these are working, don't hesitate to come back to us, and give use more details about your dataset (like samples images).

Mathieu Barnachon gravatar imageMathieu Barnachon ( 2016-04-14 14:19:57 -0600 )edit

Thanks Mathieu, I will review all info there.

rockbass2560 gravatar imagerockbass2560 ( 2016-04-14 15:42:33 -0600 )edit