How to provide Negative Samples to trainACFObjectDetector() when using a Ground Truth file

조회 수: 4 (최근 30일)
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
Anh Tran 2018년 2월 2일
(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.
Stage 1:
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.
  댓글 수: 1
Daniel Lopez
Daniel Lopez 2018년 2월 5일
Thanks a lot. Therefore, as I increase the factor of negative samples in relation to the positive provided (x5 in the example you provided), I guess the negative regions become smaller. Is there a limit (or accepted range) for such factor in order to not getting negativeROIs so small that could alter the training process?

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

Community Treasure Hunt

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

Start Hunting!

Translated by