Detect one of N objects

asked 2015-01-27 08:38:31 -0500

BillyBag2 gravatar image

updated 2015-01-28 09:35:32 -0500

I want to detect only one of N objects. The objects are similar. I can train for each object including the other objects as negative images, along with other negative images.

I can then detect each object. I should only get one hit. I can pick the one with the best match if more than one hit.

My question is, is there a better way to do this than running a detection for each object?

Can I detect the one from N objects is a single go, ether using all the training results or by training in a different way?

(I'm happy to create a new tool using OpenCV API if required.)


One project in mind to detect a model car and its crude orientation. It will be on a flat surface with the camera "level" but the camera could be at any elevation. To make the task easier for feature based stuff I choose (rightly or wrongly) eight positions where the features would be different. Front of the car, 45 degrees ie front top and one side. 90 degrees, side no front or back, etc etc. The big task is collecting training material so 'm trying to plan ahead a bit.

Steven's plan looks like a better one where I build a car detector and then a "found car" orientation detector. For the car detector was hoping to use Haar features and standard tools to create a car detector. (Maybe LBP for performances issues.)

Its very unclear to me what data I would feed the second stage (SVM?)

  • I could get the cropped image of the found car
  • I could possibly feed it the original found features from the whole image cropped to the car region. Saving the feature finding step again.
  • Possibly just the features car finder used to find the car. Already filtering irrelevant features.


Here are some images from the internet of the sort of thing...

image description

Above is what I would call a south east facing car.

image description

Above is a south west facing car.

I would like to

  • Detect the car in a scene.
  • Detect which way it is facing (one of eight)

I want to avoid creating eight different "car in scene" detectors if this is not a cleaver way of doing things. (If creating eight detects is the "best" I can do that.) (These are not training pictures just examples. Training pictures would be the car in a real scene, unfortunately I don't have a huge infinity curve for the car to drive on. )

edit retag flag offensive close merge delete



sorry, but your description of what you're doing is far too broad.

  • what are you trying to detect, what are you trying to avoid ?
  • how are you doing this ?
berak gravatar imageberak ( 2015-01-27 08:49:36 -0500 )edit

As far as I can grasp what you need, training different object detectors is the worst idea EVER. Since they are all very similar, create a single average object model to detect instances. Once found you calculate a feature that allows you to differentiate both classes. Then put those features in a classification process like an SVM, naive bayes, random tree, ...

StevenPuttemans gravatar imageStevenPuttemans ( 2015-01-27 09:58:09 -0500 )edit

Add the image which describe the problem , this will make others get the idea fatser

essamzaky gravatar imageessamzaky ( 2015-01-28 04:08:46 -0500 )edit

So you want rotation invariant car detection? Then you just apply rotation of the input image, create a rotated image space and apply a detector on top of all the layers. Then combine the detections by rewarping them over the rotate angle.

StevenPuttemans gravatar imageStevenPuttemans ( 2015-01-28 06:27:05 -0500 )edit

The car is rotating in a different axis to the camera. Only when looking straight down at the roof of the car is the image rotation and car rotation the same. Looking horizontally I may see the back of the car or the front. I need a little rotation invariance for when the camera is not held level, but that is a side issue. Unfortunately the car is not cuboidish. Its open wheel. So spotting the warped "faces" of the car is not an option, in this case. (Sorry I do not have a set of training image to post, yet. I wiil try and do so in the next few days.)

BillyBag2 gravatar imageBillyBag2 ( 2015-01-28 08:36:51 -0500 )edit

So, what you are looking for is to single out a car from all kinds of other cars, and also do this from any perspective? Seems a challenging problem indeed. A self-learning system comes to mind, like the TLD tracker (opencv 3.0 has an implementation of this tool).

Pedro Batista gravatar imagePedro Batista ( 2015-01-28 10:15:52 -0500 )edit

^^ TLD is only a tracker, it does not detect anything

berak gravatar imageberak ( 2015-01-28 10:27:27 -0500 )edit

For this problem there will only be zero or one cars in the scene, it will always be the same car, just different directions . I want to use hand held camera and also detect the car when stationary, so movement type detections will be very problematic.

BillyBag2 gravatar imageBillyBag2 ( 2015-01-28 10:34:22 -0500 )edit

I'm afraid thats not correct @berak

From the openCV documentation:

"TLD is a novel tracking framework that explicitly decomposes the long-term tracking task into tracking, learning and detection. The tracker follows the object from frame to frame. The detector localizes all appearances that have been observed so far and corrects the tracker if necessary."

Pedro Batista gravatar imagePedro Batista ( 2015-01-28 10:41:01 -0500 )edit

How can a tracker follow a specific object without having some kind of feature evaluator that classifies it as a positive example anyway?

Pedro Batista gravatar imagePedro Batista ( 2015-01-28 10:42:12 -0500 )edit