Ask Your Question
0

How to tracking multiple vehicle (e.g car and motorcycle) using haar cascade classifier?

asked Feb 9 '0

I make a detection of a vehicle running a red light using Viola Jones. however, I was confused when doing training, did I produce just 1 xml file for two types of vehicles or one 1 xml vehicle? Thank you

Preview: (hide)

Comments

1

no, you cannot train a cascade for 2 different object types

please also note, that the tools to train cascades are no more available in recent opencv

in the end -- rather look at cnn based object detection, opencv supports a lot of pretrained models with various vehicle types.

berak gravatar imageberak (Feb 9 '0)edit
1

If you are trying to detect vehicles, your training set should contain multiple images of different vehicles. After training, you get one model for the vehicle class that should be able to detect different types of vehicles.

yogeshmurthy_ gravatar imageyogeshmurthy_ (Feb 10 '0)edit

@berak By recent OpenCV, are you referring to version 3.x or 4.x? The tools to train Haar cascades still seem to exist in the 3.x version.

yogeshmurthy_ gravatar imageyogeshmurthy_ (Feb 10 '0)edit
1

you get one model for the vehicle class that should be able to detect different types of vehicles.

no, not with cascades. yes, with a cnn.

are you referring to version 3.x or 4.x?

3.x still has the tools, 4.x not so.

berak gravatar imageberak (Feb 10 '0)edit

1 answer

Sort by » oldest newest most voted
-1

answered Mar 29 '0

ComputerVisionary gravatar image

Yes it is possible both options: - 1 xml for 1 category - 1 xml for many categories.

The rigid objects approach have some limitations (ie: you cannot detect many cateogories with wide variability). Anyway it is possible to do if you consider the object in constrained scenarios. Both of approaches have pros and cons.

The support for traincascade.exe is not guaranteed with the latest versions of OpenCV. The open source world is moving massively to deep learning approaches without considering the "old school" methods are (still in 2020) the best trade-off in speed/accuracy for a lot of application. Anyway you can use earlier versions of OpenCV to train cascades, I'm still using the traincascade in Opencv 2.4.10 and it is still perfectly working and suitable for OpenCV 3 and 4. More here:

Regards!

Preview: (hide)

Question Tools

1 follower

Stats

Asked: Feb 9 '0

Seen: 3,240 times

Last updated: Mar 29 '20