Viola and Jones gives very bad results
이전 댓글 표시
Hi,
I trained Viola and Jones on a new class using the following simple code:
DBdir='C:\DB\cars-cut';
list=dir(DBdir);
negativeFolder = 'C:\Program Files\MATLAB\R2013a\toolbox\vision\visiondemos\non_stop_signs';
for ix=3:length(list)
im=imread(fullfile(DBdir,list(ix).name));
data(ix-2).imageFilename=list(ix).name;
data(ix-2).objectBoundingBoxes=[ 1 1 size(im,2) size(im,1)];
end
addpath(DBdir);
trainCascadeObjectDetector('cars.xml', data, negativeFolder, 'FalseAlarmRate', 0.0001, 'NumCascadeStages', 5);
Now, I'm testing this model on new images using the following simple code:
detector = vision.CascadeObjectDetector('cars.xml');
detector.MinSize=[60 60];
detector.MergeThreshold=50;
testDir='C:\DB\carstest200\carstest200';
list=dir(testDir);
for ix=3:length(list)
img=imread(fullfile(testDir,list(ix).name));
bbox = step(detector, img);
close all;
if ~isempty(bbox)
detectedImg = insertObjectAnnotation(img, 'rectangle', bbox, 'flower');
f=figure; imshow(detectedImg);
saveas(f,fullfile('C:\carsResults50',list(ix).name),'jpg');
end
end
I'm getting very bad results. The detector keeps missing the cars and labels other object and areas in the image.
Is there anything I'm doing wrong. Can someone please guide me in this problem? What do I need to do to get a good VJ detector?
Any help will be greatly appreciated as I'm quite stuck in this problem.
Thanks in advance,
Gil.
댓글 수: 2
Gil
2013년 8월 5일
RAMESH SEJPAL
2014년 1월 17일
How can we generate and add xml file? and what type of content can we add? can we add image? please help.......
채택된 답변
추가 답변 (2개)
tahani
2013년 11월 9일
0 개 추천
Hi, Can you help me please to find the matlab file in viola and jones algorithm (in 2013 matlab vision toolbox) which extracts features (haar, lbp or hog). this is in order to be able to change its continue aiming at using my own features.
thank you in advance
댓글 수: 3
Anand
2013년 11월 11일
Your question isn't very clear to me. It seems like you want to use your own feature descriptors to send to the Haar cascade classifier in the Computer Vision System Toolbox.
Given my understanding of the trainCascadeObjectDetector function, this is not possible. The only allowed feature types are those that you can specify using the 'FeatureType' parameter.
If you still want to have a crack at it, you can locate the file as follows:
>> edit trainCascadeObjectDetector.m
RAMESH SEJPAL
2014년 1월 17일
@Anand , In Xml file what type of content should we add for the detector?
Anand
2014년 1월 29일
If you're using the trainCascadeObjectDetector function, you don't need to add any content to the XML file. The function populates the XML file. You then use this XML file to create a detector, like so:
detector = vision.CascadeObjectDetector('xmlfilejustcreated.xml');
bbox = step(detector,new_img);
lourdes ramirez
2014년 3월 29일
0 개 추천
Did you find the training algorithm because I'm looking too.
카테고리
도움말 센터 및 File Exchange에서 Object Detection에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!