Ask Your Question

Revision history [back]

Basically you need to destinguish how OpenCV handles positive and negative image samples.

For the positive image samples OpenCV uses a file format like this: filename number_detections x1 y1 w1 h1 ... This means that you need to make an annotation file, in which you have defined which regions of your large image can be taken as positives. For each picture you make a new entry in that text file.

For the negative image samples OpenCV just wants a text file that sums op negative background images. The big difference is that resolution is not important here. At training time, the algorithm will grab your width and height parameter and use a sliding window approach over the negative images until it can grab as much negative samples (windows in this case) as you requested with the numNeg parameter. It does some sort of matching between samples to ensure that they are different enough so that training actual results in good models.

So YES 1 negative image can help, but use for model size w and h, for example 40 x 80 and supply a negative image of 400 x 800 resolution giving your algorithm the change to grab more than 1000 negative samples from that single image.