change random choice of background images for the 'opencv_createsamples' command [closed]

asked 2018-12-25 22:03:23 -0600

JamesL gravatar image

updated 2018-12-25 22:55:42 -0600

I'm creating samples from multiple images of the thing I'm trying to detect. I have 54 images of that object, and 10,000 background images. When I run the 'opencv_createsamples' command, it chooses 'random' images from the set of background images (negatives) that I have.

My problem is that on running this command multiple times it always chooses the same 'random' background images to overlay the sample on.

I'm assuming that there is a parameter for the RNG that I can change... if so, how do I do this? If not... how can I change this behaviour?

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by berak
close date 2018-12-28 11:45:33.046546

Comments

you're obviously trying to "synthesize" positive images here. don't do that, it will never lead to a good classifier. for real world problems, you need real world images, and tons of them, 54 simply are not enough.

also note, that the whole cascade based object detection is deprecated, and current opencv does no more have those tools to train it.

berak gravatar imageberak ( 2018-12-25 23:43:27 -0600 )edit

Thanks for your advice. Given that this functionality is deprecated, what should I be looking into instead to train and use a model with opencv? I'm using Python 3.6 on a Windows 10 machine. In my searching I've only found information pointing towards cascade based detection.

JamesL gravatar imageJamesL ( 2018-12-26 04:22:22 -0600 )edit

WHAT are you trying to detect ?

is there any chance, you can get more images ?

berak gravatar imageberak ( 2018-12-26 04:28:44 -0600 )edit

I'm trying to detect fish, multiple species. I do have 700 pictures with fish in them, from the 'Open Images v4' dataset. The fish are of various sizes and locations and numbers though.

JamesL gravatar imageJamesL ( 2018-12-26 04:33:53 -0600 )edit

yea, then cascades are the wrong idea anyway. (they don't handle variations in shape or pose nicely.)

probably re-training an existing object detection cnn, like SSD-mobilenet might be a better idea.

berak gravatar imageberak ( 2018-12-26 04:38:20 -0600 )edit

Alright, thanks, I'll check that out. I appreciate your help :)

JamesL gravatar imageJamesL ( 2018-12-26 04:42:46 -0600 )edit