Cascade Object Detector: Unable to generate a sufficient number of negative samples

1 view (last 30 days)
Hi, I am using the cascade object detector. I'm currently using the training image labeler to draw a bounding box around the ROI. However, when I run the command, trainCascadeObjectDetector, it only includes the positive images which I've provided in the training labeler and it will use the positive images to generate negative samples.
Also, I have this error message. "Cannot find enough samples for training."
"Unable to generate a sufficient number of negative samples for this stage. Consider reducing the number of stages, reducing the false alarm rate or adding more negative images."
May I know how do I train my negative images to include in the cascade object detector? I have my own set of negative images that I wish to include into my training sets. Thanks!

Accepted Answer

Dima Lisin
Dima Lisin on 1 Dec 2015
Hi Leonard,
Negative images are images that do not contain the objects that you are trying to detect. They should, however, contain backgrounds that are typically associated with your objects of interest. So if you are trying to detect stop signs, the negative images should be pictures of streets and roads with no stop signs in them.
The Training Image Labeler app does not directly produce the negative images. The simplest thing is to capture of find them yourself. If that is difficult, then you can take the output of the Training Image Labeler app, and fill the regions corresponding to the bounding boxes with zeros or random noise.
Leonard Yeo
Leonard Yeo on 11 Dec 2015
Hmmm.. So I cannot combine both set of detector codes into one program to run? I have to run 2 different files separately at each time for the detection?
Dima Lisin
Dima Lisin on 11 Dec 2015
You would need to train two separate detectors, and get two separate XML files. Then you would need to create two separate vision.CascadeObjectDetector objects, and run each one on your image. You can certainly have two detector objects in the same program (or function).

Sign in to comment.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!