my own cascade not detecting object?

asked 2018-04-23 00:52:05 -0500

usuf gravatar image

i have 8 positives and 2100 negatives for that i creates sample for 1840 samples ...after that i created vec file....after that train my cascade all done well
but when i check my cascade its not even detecting object from image also....? any one knows wat is the problem

edit retag flag offensive close merge delete


  • "i have 8 positives" -- that's not enough
  • "i creates sample for 1840" -- this does not work with "real world" objects
berak gravatar imageberak ( 2018-04-25 03:09:51 -0500 )edit

i am going to create cascade for that can detect one object(lock) for that one object this is enough positives from my opinion. ...i followed the following tutorial to create cascade ""

usuf gravatar imageusuf ( 2018-04-25 05:10:48 -0500 )edit

use docs , not silly blogs, they're all lying.

berak gravatar imageberak ( 2018-04-25 05:17:32 -0500 )edit

Thanks....but...can u sugges many samples i need to detect the object from real time...?

usuf gravatar imageusuf ( 2018-04-25 05:25:17 -0500 )edit

as many as you can get

berak gravatar imageberak ( 2018-04-25 05:38:22 -0500 )edit

Like @berak said, the ratio 8 - 2100 is simply terrible and will result in overfitting on those 8 samples. As you clearly saw, I already ignored the 1840 artificial samples, please stay away from that if you want a robust solution. I would say, go for 250-2100 ratio for a starter and see where that gets you!

StevenPuttemans gravatar imageStevenPuttemans ( 2018-04-25 06:27:26 -0500 )edit

hi all...

i have 32 positive image that contain my object and 900 negative pictures do not contain my object for that i am created sample for all the 32 positive , each positive contain 125 sample like wise 125 *32 =4000 sample file i created..

opencv_createsamples -img train/1.png \ -bg test_neg.txt \ -info sample_test/pos1.txt \ -num 125 -maxxangle 0.0 -maxyangle 0.0 \ -maxzangle 0.3 -bgcolor 255 -bgthresh 8 \ -w 20 -h 20 (1.png ,1.png,2.png........32.png)

after that i merged that all the positive text file to one main file for that i am created the vector file as follows opencv_createsamples \ -info sample_test/pos_test.txt \ -bg test_neg.txt \ -vec test_pos.vec \ -num 4000 -w 20 -h 20 with numpos 2500 numNeg 700 stil not getting out?

after that train the cascade

usuf gravatar imageusuf ( 2018-04-26 00:30:56 -0500 )edit

@StevenPuttemans For the 8 positive i created 1840 samples we use sample file and neg file for the train what is the problem in it?

usuf gravatar imageusuf ( 2018-04-26 00:35:45 -0500 )edit

The -maxxangle 0.0 -maxyangle 0.0 \ -maxzangle 0.3 -bgcolor 255 -bgthresh 8 create artificial samples that are in my opinion unrelated to real world samples and hence destroy the effectiveness of your classifier. That is why we suggest to use pure samples only. Again have a look at the official documentation and read it step by step!

StevenPuttemans gravatar imageStevenPuttemans ( 2018-04-26 02:55:53 -0500 )edit

@StevenPuttemans from ur idea ....instead of creating artificial sample......v have to directly pos the original object file for the training right?

in that documentation heading "Positive Samples" said to create the artificial images using opencv_createsample command? here

usuf gravatar imageusuf ( 2018-04-26 03:01:45 -0500 )edit