0

I was thinking of doing a little project that involves recognizing simple two-dimensional objects using some kind of machine learning. I think it's better that I have each network devoted to recognizing only one type of object. So here are my two questions:

  1. What kind of network should I use? The two I can think of that could work are simple feed-forward networks and Hopfield networks. Since I also want to know how much the input looks like the target, Hopfield nets are probably not suitable.

  2. If I use something that requires supervised learning and I only want one output unit that indicates how much the input looks like the target, what counter-examples should I show it during the training process? Just giving it positive examples I'm pretty sure won't work (the network will just learn to always say 'yes').

The images are going to be low resolution and black and white.

Paul Manta
  • 30,618
  • 31
  • 128
  • 208
  • There are many machine learning methods for performing the described task, but you're specifically referring neural networks - is this intentional? – etov Feb 14 '13 at 14:31
  • @etov These are the ones I'm most familiar with. I'm willing to learn about others, if they are more appropriate for this task. – Paul Manta Feb 14 '13 at 14:34

2 Answers2

4

First, a note regarding the classification method to use. If you intend to use the image pixels themselves as features, neural network might be a fitting classification method. In that case, I think it might be a better idea to train the same network to distinguish between the various objects, rather than using a separate network for each, because it would allow the network to focus on the most discriminative features.

However, if you intend to extract synthetic features from the image and base the classification on them, I would suggest considering other classification methods, e.g. SVM. The reason is that neural networks generally have many parameters to set (e.g. network size and architecture), making the process of building a classifier longer and more complicated.

Specifically regarding your NN-related questions, I would suggest using a feedforward network, which is relatively easy to build and train, with a softmax output layer, which allows assigning probabilities to the various classes. In case you're using a single network for classification, the question regarding negative examples is irrelevant; for each class, other classes would be its negative examples. If you decide to use different networks, you can use the same counter-examples (i.e. other classes), but as a rule of thumb, I'd suggest showing no more than 2-10 negative examples per positive example.

EDIT: based on the comments below, it seems the problem is to decide how fitting is a given image (drawing) to a given concept, e.g. how similar to a tree is the the user-supplied tree drawing.

In this case, I'd suggest a radically different approach: extract visual features from each drawing, and perform knn classification, based on all past user-supplied drawings and their classifications (possibly, plus a predefined set generated by you). You can score the similarity either by the nominal distance to same-class examples, or by the class distribution of the closest matches.

I know that this is not neccessarily what you're asking, but this seems to me an easier and more direct approach, especially given the fact that the number of examples and classes is expected to constantly grow.

etov
  • 2,972
  • 2
  • 22
  • 36
  • The reason I want to have a network per object is so that I could easily add more objects later on. I always know what the object is supposed to be, so I'll know which one of the trained networks to use. I could use images from all the other objects as negative examples. – Paul Manta Feb 14 '13 at 15:05
  • This is still a little unclear, "I always know what the object is supposed to be" - so there are several object "classes", and you'd like to train a network per class? e.g. you'd like to identify faces with one network, flowers with another one, etc.? if this is the case, the "objects" you'd like to be able to add are additional "classes"? – etov Feb 14 '13 at 15:13
  • It's a drawing application. For example, I ask the user to draw a tree and the network rates the drawing according to how much it looks like a tree. The "objects" are additional "classes", yes. – Paul Manta Feb 14 '13 at 15:24
  • One-classifier-per-class is a perfectly reasonable approach that scales better with number of classes, though it sometimes doesn't do as well as training one classifier per pair of classes and voting among them. – Danica Feb 14 '13 at 15:32
  • +1 For the KNN approach. I don't know if I'm actually going to use it, because I don't really want to store all previous examples. But in case I can't make FFNNs work, I'll have this option to try next. – Paul Manta Feb 14 '13 at 18:23
2

Have a play with FindObject and see if you like object detection with OpenCV using feature detection/description. If it seems like a good match, then you can try the find_obj.py demo included with the opencv package.

I however found the demo pretty confusing since I wasn't already familiar with the underlying concepts. I made a more linear demo that spells things out and points out some pitfalls if you want to check it out on github.

KobeJohn
  • 7,390
  • 6
  • 41
  • 62
  • I see from your comment on another answer that you aren't really searching for objects, but rather measuring the quality of an object. The object detection I mentioned probably won't help with that. Interesting problem though. Please post if you get a solution. – KobeJohn Feb 14 '13 at 15:27