I need to compare a picture and decide whether or not it is similar to another one. In this case, I would like to use a simple perceptron that compares pixelmaps of both pictures. But I have only very basic understanding of neural networks and I am not sure whether this approach will work if there is only one source picture (to train it with). Anything I could do in this case?
3
When you train a neural network, you need both positive and negative inputs. If you were to say, only indicate to a neural network that when given an image that it should return 1, when given an image which is not similar, it may return 1 all the same.
And in this circumstance, while there is only 1 image you’d like other images to be similar to, there are many many many images which are not similar that should return 0 or close to 0. Before the neural network will return results similar to what you’d expect, you must be the one to show it what you expect.
Supposing you wanted to have it match photos containing the same person’s face. You would train your neural network to return 1 in these with precisely that person’s face inside the photo. You would then show it photos of other people’s faces and return 0.5. Then you would show it photos of bridges, buildings, people without closeups and have it return 0. At this point, you have what would be a very crude face recognition neural network. I doubt if you would be able to have a neural network provide any value of meaning with just one photo.
As always with neural networks, it’s difficult to say anything for sure without actually trying it out. But I think the fact that you’ve only got one “source” is unlikely to cause problems. In fact, it might simplify things. The important thing is to have lots of images to compare it to for training.
For the structure of the network, I don’t think you’d need to supply the source as an input: as it would be the same for all of the training data, it wouldn’t actually be doing anything! Instead, the perceptron should learn it from how similar each of the other images are.
Just bear in mind that the perceptron would become trained to that one source, i.e. you wouldn’t be able to change the source picture without completely re-training. Also as I said above, make sure you’ve got a large training set (i.e. the comparison images).
Note: I haven’t done much at all with images in neural networks, so I can’t comment on some of the other points such as whether pixelmaps would be suitable.