How to train a cascade classifier for a a fixed image (logo)
I have attempted to train a haar cascade classifier several times with varying, bad results. I created several positive sample images of a card with the logo printed on it. I added several block-like features to the card to make it easier to recognize. I downloaded a set of negative sample images. I generated vectors and samples with commands I pieced together from several websites, mainly this one: http://coding-robin.de/2013/07/22/tra... I am using OpenCV 3.0 rc1
I tried a range of stages, from 5 to 20. I have tried from 100 to 1500 positive samples and from 500 to 2000 negative samples. I have tried window sizes from 20x20 to 48x48 (the card I want to detect is square).
None of the cascade files have been any good. Some won't detect anything. Some detect almost everything... but not the card! I've checked over everything I can think of - like did I actually get the positive samples in the right directory...
I'm at a loss. Are there some common rookie mistakes I should double check? Has anyone had bad results like this? Are bad cascade files common? My target seems much easier to classify than most problems since it is a fixed image. Does that change the problem somehow in a way I do not grasp?
What kind of features are you using? Could you please show one of your positive and negative samples?
If you have a single fixed image/logo, the why the hell would you apply cascade classifiers (who are specifically designed to model variance of an object class into a single model for detection). I would suggest investigating techniques like keypoint matching, template matching, ...
Positive and negative samples. The originals are four times larger. I downscaled for sharing. https://www.dropbox.com/s/5y1g88zrqff...https://www.dropbox.com/s/jiai7vo4yrk...
When you say "what kind of features?" Do you mean haar, hog, lbp? If so then I believe it's Haar. I didn't specify anywhere but the cascade file indicates haar in the xml.
I am interested in possibly using other methods, Steven. Thank you for the advice. I am currently investigating cascade classifiers because A. they are fast B. my initial test with bag-of-words/feature points gave poor results.
I am using Java on an Android device so SURF and SIFT are not available. Even if they were the patent would be an issue. I tried bag-of-words matching using ORB and a few other descriptors but I was getting a large number of matching points when the card wasn't visible followed by a very small (insignificant) increase in matching points when the card became visible.
I am also concerned that if I try to detect many possible templates at once the performance may become an issue with feature point matching.
That being said, I'm open to ideas :-)
Cascade classifiers fast? I can give you tons of examples where that isn't the case. Certainly not if you have a large image pyramid and many different scales.
From what I understand a cascade classifier should be fast for my problem. The problem is relatively simple and there are many commercial devices that use cascades on modest hardware. That is why I'm confused by my results. It seems I must be doing something wrong to have so many false positives and no correct identifications.