Viola and Jones gives very bad results
Show older comments
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 Comments
Gil
on 5 Aug 2013
RAMESH SEJPAL
on 17 Jan 2014
How can we generate and add xml file? and what type of content can we add? can we add image? please help.......
Accepted Answer
More Answers (2)
tahani
on 9 Nov 2013
0 votes
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 Comments
Anand
on 11 Nov 2013
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
on 17 Jan 2014
@Anand , In Xml file what type of content should we add for the detector?
Anand
on 29 Jan 2014
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
on 29 Mar 2014
0 votes
Did you find the training algorithm because I'm looking too.
Categories
Find more on Object Detection in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!