Ask Your Question

Need Suggestion for Detecting

asked 2014-01-30 01:38:50 -0500

ART gravatar image

updated 2014-02-22 06:10:57 -0500

berak gravatar image

Hi All,

I'm trying to create an xml for detecting the cars using opencv .

Now my question is that for detecting the car should i need to create 4 different xml i.e,(front,back ,left and right ) view xml's by using 4 different sets of the positive images . or else all sets of data together. and which method haartraining or traincascade is the best way to create cascade xml for object detection ??

Thank You.

edit retag flag offensive close merge delete

3 answers

Sort by ยป oldest newest most voted

answered 2014-01-30 04:57:19 -0500

updated 2014-01-30 05:07:17 -0500

When it comes to car detection normally people divide the task in front, back and lateral views, no need to train right and left separately. You should use traincascade instead of haartraining. It is the newest version of casade training application, it is faster and has more training options.

edit flag offensive delete link more


thanks for your reply and what is the ratio of images should i need to take i.e.,(positive:negative ) is it 1:2 or 2:1 ratio .

ART gravatar imageART ( 2014-01-31 04:59:41 -0500 )edit

2 negatives for each positive should be a good start

Pedro Batista gravatar imagePedro Batista ( 2014-01-31 09:21:01 -0500 )edit

thanks once again.. can u suggest good tutorial for generating classifier using traincascade . I have followed this tut done up to creating the .vec file and when i am trying to start the training for +ive and -ive . It is getting aborted. can you please help me out.

ART gravatar imageART ( 2014-02-01 05:00:09 -0500 )edit

This is a pretty popular tutorial . It uses the old haartraining app instead of traincascade, but the principles are the same.

Pedro Batista gravatar imagePedro Batista ( 2014-02-03 04:26:51 -0500 )edit

Hi , i am done with creating .vec file and now when i am making for training using cascadetraining using the following command: C:\haar>traincascade.exe -data result -vec data\positive.vec -bg Negative\negative.txt -numPos 100 -numNeg 300 -numStage 10 -featureType LBP -precalcvalBufSize 1024 -precalcIdBufSize 1024

i am getting this error . OpenCV Error: Parsing error (result/params.xml(8): Duplicated key) in unknown function, file ......\src\opencv\modules\core\src\persistence.cpp, line 717 can you help me this thanks

ART gravatar imageART ( 2014-02-03 08:38:29 -0500 )edit

I'm not sure what might be the problem, but you are not specifying the width and height of the positive samples. You should add two aditional parameters -w and -h

Pedro Batista gravatar imagePedro Batista ( 2014-02-03 08:50:27 -0500 )edit

ya ok thanks

ART gravatar imageART ( 2014-02-03 21:33:58 -0500 )edit

Hi Median, I still facing problem with train cascade training. if you are done.can you suggest me how to build traincascade.exe i guess i am missing out there and can you tell me the version of opencv your using?? Thanks in advance.

ART gravatar imageART ( 2014-02-19 06:15:19 -0500 )edit

You'll have to be more specific in what you are trying and what problem is occurring.

Pedro Batista gravatar imagePedro Batista ( 2014-02-20 10:31:46 -0500 )edit

Traincascade.exe is not working in my case i.e., can you tell me by using which version of opencv you have build the Traincascade ??? and it is getting aborted after 0 stage.

ART gravatar imageART ( 2014-02-22 05:26:10 -0500 )edit

answered 2014-01-30 05:02:44 -0500

For multi-view car detection, I suggest taking a look at other frameworks like deformable parts models (of which a latentSVM implementation is available in openCV). It has 3 views, each with their responsible HOG model existing of a root filter and several part filters.

A simple VJ cascade classifier won't do the job unless you combine multiple single models, which will be slower than a DPM model.

edit flag offensive delete link more

answered 2014-02-22 03:21:06 -0500

FLY gravatar image

updated 2014-02-22 08:58:13 -0500

Well i think you need to focus on detection using feature extraction algorithms like SURF/SIFT with SVM approach , this may helpfull too for you as so also need to dataset for SVM , you can generate xml file out of it , you can use SVM approach for training all the views of vehicle or you can generate different xml files of each view. You can get the tutorials from here and here

edit flag offensive delete link more


Actually feature detection like sift and surf will probably only work if you want to detect that exact car type, The class of cars however has so much variation that there is a reason why academics don't use this approach for car and pedestrian detection.

StevenPuttemans gravatar imageStevenPuttemans ( 2014-02-24 06:18:58 -0500 )edit

@StevenPuttemans Thanks for my correction , but what if we have huge data of many types of cars and we train it using SVM with SURF ?

FLY gravatar imageFLY ( 2014-02-24 08:21:52 -0500 )edit

My guess you will overtrain to your data or not be able to create a general class model that seperates positives and negatives rather well. I think for your option, DPM models or combined cascade models are the way to go.

StevenPuttemans gravatar imageStevenPuttemans ( 2014-02-24 08:47:43 -0500 )edit

okay thank you i will check it out

FLY gravatar imageFLY ( 2014-02-24 09:36:21 -0500 )edit

i am getting some decent results with it

FLY gravatar imageFLY ( 2014-02-24 11:06:19 -0500 )edit

I do agree that it can work, but won't be the optimal solution. Did you try running this on live data and reach real time performance? I guess this is close to impossible with this technique :)

StevenPuttemans gravatar imageStevenPuttemans ( 2014-02-25 04:28:51 -0500 )edit
Login/Signup to Answer

Question Tools


Asked: 2014-01-30 01:38:50 -0500

Seen: 724 times

Last updated: Feb 22 '14