How to provide Negative Samples to trainACFObjectDetector() when using a Ground Truth file
1 view (last 30 days)
Show older comments
Daniel Lopez on 24 Jan 2018
Commented: Daniel Lopez on 5 Feb 2018
I am using 2017b version, with Computer Vision Toolbox. I've already generated a Ground Truth file using the Image Labeler App, by labelling each ROI. The file contains several different rectangular labels spread in close to a thousand images.
Now I am using trainACFObjectDetector() only for one of the labels from this Ground Truth file. Everything works fine and I've got a full working detector that certainly seems to do what expected. Anyway, I want to tune the process in order to decrease both false-positive and false-negative rates.
Therefore, A question arised me regarding to the provision of Negative Samples, and none of the examples and information on the web is guiding me thrugh that. So here is the question:
When using the Image Labeler app to generate a Ground Truth file and afterwards train a detector:
(1) Do I have to provide the Negative Samples folder? I have seen this in some examples but none of them when using Ground Truth file.
negativeFolder = fullfile('C:\Users\...');
negativeImages = imageDatastore(negativeFolder);
(2) Do I have to add negative samples inside the Image Labeler app session (not marking any ROI on them)?
(3) Does Matlab any crop of the non-marked ROI during the labelling session in the Image Labeler app to generate the needed negatives?
Thanks a lot in advance. Daniel
Anh Tran on 2 Feb 2018
(3) is correct. You do not have to add negative samples because trainACFObjectDetector automatically generates negative samples from your labeling session (non ROIs). Thus, you do not have to provide Negative Samples folder.
You can verify by following this example. Although you only pass in 42 images with positive ROIs, the training uses 210 negatives examples.
Sample negative examples(~100% Completed)
Compute aggregated channel features...Completed.
Train classifier with 42 positive examples and 210 negative examples...Completed.
The trained classifier has 19 weak learners.
Hope this helps.
More Answers (0)
Find more on Ground Truth Labeling in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!