Ask Your Question

vehicle detection and tracking with haar features

asked 2014-04-01 08:13:15 -0500

sy456 gravatar image

updated 2015-09-05 08:39:37 -0500


I am trying to detect and track vehicles by using Haar Feature-based Cascade Classifier in OpenCV. However, I got lots of false positives. Is there any way to eliminate false positives?


edit retag flag offensive close merge delete


I think you have to look into the topic called 'hard negative mining' or 'hard negative learning'

StevenPuttemans gravatar imageStevenPuttemans ( 2014-04-01 08:40:47 -0500 )edit

I would try more elaborate techniques, such as OpenTLD

GilLevi gravatar imageGilLevi ( 2014-04-01 08:45:20 -0500 )edit

OpenTLD is used to track single objects, also you need to define bounding box by hand. However,I need to detect multiple objects automatically.

sy456 gravatar imagesy456 ( 2014-04-01 09:05:46 -0500 )edit

Like @sy456 said, OpenTLD won't do the trick here, since it is a tracker system. You still need the detector part before switching to a tracker approach to be completely robust against missing detections.

StevenPuttemans gravatar imageStevenPuttemans ( 2014-04-02 01:40:05 -0500 )edit

@StevenPuttemans, I checked Beyond Hard Negative Mining ( Afaik, it improves the training part. Have you evert tried it?

sy456 gravatar imagesy456 ( 2014-04-02 04:03:10 -0500 )edit

Euhm, the title says BEYOND hard negative mining ... ofcourse this is not what you want. Basically what you need to do now is using your existing model with tons of false positives, let it run over lets say 5000 large negative images. Cut out all detections and resize them towards the model size, then use them as negatives in your negative.txt file. Make sure they are at the top so that they are explicitly used for training! With each iteration, your performance will increase but so will the training time to get a new model.

StevenPuttemans gravatar imageStevenPuttemans ( 2014-04-02 04:12:20 -0500 )edit

Actually, I used cars3.xml that @albertofernandez mentioned without using negative.txt It is trained with old haar training. I think i need to use train cascade with new negative images.

sy456 gravatar imagesy456 ( 2014-04-02 05:02:30 -0500 )edit

The cars3.xml is trained with negatives. It is impossible to train a model without specifying what isn't an object...

StevenPuttemans gravatar imageStevenPuttemans ( 2014-04-03 02:29:31 -0500 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2014-04-01 11:02:54 -0500

Vehicle Detection with Haar Cascades

The source code can be downloaded at:

The cars3.xml was created by Brad Philip and Paul Updike, for more information see:

There are many useful information, image database, and more at:

youtube video: (Basic Vehicle Detection using Haar Cascades)

But this page has methods also for:

  • Vehicle Detection, Tracking and Counting
  • Vehicle Detection with Haar Cascades
  • Vehicle Detection with Background Subtraction
  • Vehicle Tracking and Counting

More info:

edit flag offensive delete link more


actually, i already achieved that part:) thanks anyway

sy456 gravatar imagesy456 ( 2014-04-01 14:53:38 -0500 )edit
Login/Signup to Answer

Question Tools



Asked: 2014-04-01 08:13:15 -0500

Seen: 20,960 times

Last updated: Apr 01 '14