Detect one of N objects
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.)
EDIT
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.
EDIT2
Here are some images from the internet of the sort of thing...
Above is what I would call a south east facing car.
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. )
sorry, but your description of what you're doing is far too broad.
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, ...
Add the image which describe the problem , this will make others get the idea fatser
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.
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.)
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).
^^ TLD is only a tracker, it does not detect anything
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.
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."
How can a tracker follow a specific object without having some kind of feature evaluator that classifies it as a positive example anyway?