Ask Your Question
0

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

asked 2020-02-09 01:51:43 -0600

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

edit retag flag offensive close merge delete

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 ( 2020-02-09 03:15:43 -0600 )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_ ( 2020-02-10 02:49:00 -0600 )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_ ( 2020-02-10 02:51:34 -0600 )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 ( 2020-02-10 02:54:30 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
-1

answered 2020-03-29 05:21:45 -0600

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!

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2020-02-09 01:51:43 -0600

Seen: 2,941 times

Last updated: Mar 29 '20