How to input the image to the neural network?

Dzen picture Dzen · Jan 18, 2010 · Viewed 29.1k times · Source

I understand how neural networks work, but if I want to use them for image processing like actual character recognition, I can't understand how can I input the image data to the neural net.

I have a very big image of an A letter. Maybe I should try to get some info/specifications from the image and then use a vector of values of that specification? And they will be the input for the neural net?

Who has already done such a thing, can you explain how to do this?

Answer

ahans picture ahans · Jan 18, 2010

The easiest solution would be to normalize all of your images, both for training and testing, to have the same resolution. Also the character in each image should be about the same size. It is also a good idea to use greyscale images, so each pixel would give you just one number. Then you could use each pixel value as one input to your network. For instance, if you have images of size 16x16 pixels, your network would have 16*16 = 256 input neurons. The first neuron would see the value of the pixel at (0,0), the second at (0,1), and so on. Basically you put the image values into one vector and feed this vector into the network. This should already work.

By first extracting features (e.g., edges) from the image and then using the network on those features, you could perhaps increase the speed of learning and also make the detection more robust. What you do in that case is incorporating prior knowledge. For character recognition you know certain relevant features. So by extracting them as a preprocessing step, the network doesn't have to learn those features. However, if you provide the wrong, i.e. irrelevant, features, the network will not be able to learn the image --> character mapping.