Cascade Object Detector: Unable to generate a sufficient number of negative samples
이 질문을 팔로우합니다.
- 팔로우하는 게시물 피드에서 업데이트를 확인할 수 있습니다.
- 정보 수신 기본 설정에 따라 이메일을 받을 수 있습니다.
오류 발생
페이지가 변경되었기 때문에 동작을 완료할 수 없습니다. 업데이트된 상태를 보려면 페이지를 다시 불러오십시오.
이전 댓글 표시
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!
채택된 답변
Dima Lisin
2015년 12월 1일
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.
댓글 수: 12
Leonard Yeo
2015년 12월 2일
편집: Leonard Yeo
2015년 12월 2일
Hi Dima,
I do have my own set of negative images which I would like to include in my training set however, I do not know how to include them in.
trainCascadeObjectDetector takes a parameters called negativeImages. It can either be a cell array containing the file names of the negative images, or it can be a directory where the negative images are stored.
Do I include negative image into the Training Image Labeler?
No, because you do not need to label anything in the negative images. You just need to tell trainCascadeObjectDetector where they are.
How do I resolve "Unable to generate a sufficient number of negative samples" issue? I have added more negative images into the folder but it is still giving the same problem. Currently, I have 600 positive and 1100 negative samples. Below is my code:
%%Load data
% Training image labeler (ROI)
load('trainingImage.mat');
data = positiveInstances;
% Positive images folder
imDir = 'C:\Users\MATLAB\Photos\Training\Positive';
addpath(imDir);
% Negative images folder
negativeFolder = 'C:\Users\MATLAB\Photos\Training\Negative';
trainCascadeObjectDetector (train image):
trainCascadeObjectDetector('output.xml',data,...
negativeFolder,'FalseAlarmRate',0.2,'NumCascadeStages',15,...
'TruePositiveRate',0.995,'FeatureType','Haar');
What kind of objects are you trying to detect? What do your negative images look like?
In the mean time try increasing the FalseAlarmRate to 0.5. If that doesn't work, try decreasing the NegativeSamplesFactor to 1.5.
Also note that there is difference between "negative samples" and "negative images". What you are providing to the function are negative images, which should be large. The function generates the negative samples automatically from the negative images.
I am trying to detect wheelchairs. My negative images are background of hospitals without any wheelchairs.
If I were to increase my FalseAlarmRate to 0.5, wouldn't it have a higher false positive?
I would think detecting wheelchairs would be hard... You may have to train multiple detectors (side view, front view, etc.).
Increasing FalseAlarmRate is ok, as long as you have enough stages. If FalseAlarmRate is .5, then after two stages the overall false positive rate will be 1/4. After 3 stages it will be 1/8, and so on.
Alright but how do I combine multiple detectors into one if I have split my images and trained them into sub-categories?
You would have to run each detector separately.
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?
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).
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Image Processing and Computer Vision에 대해 자세히 알아보기
태그
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!웹사이트 선택
번역된 콘텐츠를 보고 지역별 이벤트와 혜택을 살펴보려면 웹사이트를 선택하십시오. 현재 계신 지역에 따라 다음 웹사이트를 권장합니다:
또한 다음 목록에서 웹사이트를 선택하실 수도 있습니다.
사이트 성능 최적화 방법
최고의 사이트 성능을 위해 중국 사이트(중국어 또는 영어)를 선택하십시오. 현재 계신 지역에서는 다른 국가의 MathWorks 사이트 방문이 최적화되지 않았습니다.
미주
- América Latina (Español)
- Canada (English)
- United States (English)
유럽
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
