필터 지우기
필터 지우기

Viola and Jones gives very bad results

조회 수: 1 (최근 30일)
Gil
Gil 2013년 8월 5일
답변: lourdes ramirez 2014년 3월 29일
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
Gil 2013년 8월 5일
Any suggestion on other methods for cars detection will be also useful. Thanks!!
RAMESH SEJPAL
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.......

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

채택된 답변

Anand
Anand 2013년 9월 23일
There could be a bazillion things wrong...who knows! You're going to have to do some digging here.
Here are a couple of things to try/watch out for:
1. Check how you're doing on the training set itself. Do you get poor results on the training data or is it better there? If you're doing poorly on the training set, it may mean you're doing something wrong. If you're doing too well on it, you may have over-fitted to the training set.
2. Have you tried different feature descriptors? How do the results vary with LBP or HOG?
3. What makes you think you need 5 cascade stages? Why not 3, why not 10, why not the default of 20?
4. It could be that the dataset is too noisy. Maybe you need to preprocess the images so the cascade object detector can get a more standardized set of images to learn from.
5. Have you looked at this page on how to train cascade object detectors?
There's a lot of information in there that could be useful.
Hope this helps!
  댓글 수: 3
RAMESH SEJPAL
RAMESH SEJPAL 2014년 1월 16일
HI ,I am also working for car detection ,Please would you help me ,how can I use viola and Jones algorithm for car detection?
Anand
Anand 2014년 1월 29일
You need a data set of images of cars with bounding boxes for positive training and a set of images for negative training. Use these with the link in the above answer and you should be on your way.

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

추가 답변 (2개)

tahani
tahani 2013년 11월 9일
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
RAMESH SEJPAL
RAMESH SEJPAL 2014년 1월 17일
@Anand , In Xml file what type of content should we add for the detector?
Anand
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
lourdes ramirez 2014년 3월 29일
Did you find the training algorithm because I'm looking too.

Community Treasure Hunt

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

Start Hunting!

Translated by