# Logo recognition - how to improve productivity

I am working on a TV channel recognition project. I take photos of the feeds to suck that I try to avoid the background and take a sample from the center of the logo. I recognize 4 different logos, here are the templates:

**How my pattern matching algorithm works:**

Given 4 100x100 patterns, each representing a different TV channel, each with a different threshold (probabilities). The user grabs the logo from the TV and then the algorithm: - Run 4 independent pattern matches on each template to get the probability that each template will match the captured image. - for each channel probability, if the channel probability is lower than the channel threshold, the probability changes by 0; - declare a recognized logo with the highest probability. If all probabilities are 0, declare no recognition.

For example, if I received one channel with a probability of 0.85 and a threshold of 0.9, and the second channel with a probability of 0.8 and a threshold of 0.75, then the second channel "wins".

When I photograph one of the logos, 95% of the time it recognizes photographs.

** Current results:**

- When I tried to detect the first ("smiling face" logo) of 10 detections, I got 10 correct detections. For pattern matching between the correct pattern and the image, I get probabilities between 0.91 - 0.94. For other logos, I get probabilities between 0.77 and 0.91.
- When I tried to find the second ("green" logo) out of 10 detections, I got 10 correct detections. For pattern matching between the correct pattern and the image, I get probabilities between 0.78 and 0.91. For other logos, I get probabilities between 0.71 and 0.83 (but due to the high threshold, detection succeeds).
- When I tried to find the third ("round" logo) out of 10 detections, I got 9 correct detections. For pattern matching between correct pattern and image, I get probabilities between 0.83 and 0.92. For other logos, I get probabilities between 0.73 and 0.91.
- When I tried to find the fourth ("black and white" logo) out of 10 detections, I got 10 correct detections. For pattern matching between the correct pattern and the image, I get probabilities between 0.91 - 0.94. For other logos, I get probabilities between 0.78 and 0.92.
- When trying to detect a "negative" image many times, I get logo detection (which is bad). If I take a full white sheet image, for example, it detects the first, third and fourth logos with more than 0.9 probability

How can I improve my algorithm or modify it to get better results on "negative" images?

Thanks for the help,

Eyal

source to share

It all depends on how you calculate the channel probabilities from templates. Are you using a color histogram or gradient histograms and then looking at the histogram difference between your templates and test images?

Another approach would be to compute feature vectors from test images like gradient histogram concatenation and color histogram. Then manually create a sample database where you know the label (1, 2, 3, or 4 depending on which label is visible in the image) and you can feed the hardcoded labels along with histogram functions into the classifier routine. I recommend LIBSVM for this, and scikits.learn's implementation is easy to use for this in Python.

This will give the support machine classifier that will compare the object vector of the new images with the support vectors from the training set and determine the correct label that is most likely present in the image. You can then install the logistic model on top of this SVM if you want something that gives the probabilities, not just the predicted labels.

Two good books to read to get you started in this type of machine learning are Pattern Classification , Duda, Hart, and Stork, and Pattern Recognition and Machine Learning .

Some of the messy Python code I wrote to implement Poselets and oriented gradient histograms in Python can be found here ; maybe you can grab some sections of the code there and it will be suitable for your task.

source to share