I've been using MATLAB's neural network toolbox to generate good for character recognition. I wanted to develop my own to compare against and also try and use different methods for weight updates. I've got the network to return only values between 0 and 1. I was wondering how I can adapt this so that the network returns say 1, 2, 3, 4; numbers corresponding to rows in my data matrix, where each row is a different letter.
1 Answers
Usually when talking about character multiple character recognition it is a good approach to instead of using only 1 output to use an output for each of the characters you have. So if you have 10 characters (say digits from 0-9) you can have N inputs (1 per pixel) and 10 outputs (1 per character). Like that you can not only get a result, but analize how good is your NN tuned and how good is your result precision.
So if you input an image and the result is [0.2 0.1 0.98 0.3 0.12 0.2 0.1 0.4 0.1 0.2]
you know that the NN is pretty well tuned and the result is very accurate, but instead if you get [0.4 0.1 0.6 0.54 0.5 0.3 0.5 0.3 0.57 0.2]
you know that even if the number seems to be the same as before, the fiability of the result is much lower.
Having said that you can just train you NN to give you a nu,ber from 0 to 1 for each case, if you still want to do it with 1 output.
0 ->0
1->0.1
2->0.2
...
Still I can assure you that your result are going to be worse like this. Use 1 output from 0 to 1 for each digit!

- 35,140
- 11
- 74
- 120
-
if my input vector is as follows, letter_X = [0 1 0; 1 0 1; 0 1 0]; letter_C = [0 0 0; 0 1 1; 0 0 0]; input=[letter_X(:),letter_C(:)]; what should my target vector look like? It shouldn't be the same as input. – roldy May 10 '13 at 01:13
-
@roldy First choose how many characters do you want to recognise. So if you want to recongines 4 different characters (e.g `[X,Y,C,M]`) your desired output for `letter_X` is `[1,0,0,0]` and for `letter_C` is `[0, 0 , 1 ,0]`. – Ander Biguri May 10 '13 at 12:53
-
@roldy if it helped you dont forget to mark the aswer as correct! – Ander Biguri May 11 '13 at 00:24
-
I forgot to ask in the original question how I would go about using this trained network to recognize a selected letter? Would I just multiply the weights with the selected input? That doesn't seem right. – roldy May 11 '13 at 07:50
-
IF you are using Matlab NNtoolbox try searching the help. There are very nice examples @roldy – Ander Biguri May 12 '13 at 18:13
-
I've actually coded my own multi-layer perceptron. Using the NNtoolbox is no problem. But as far as using a trained network that I coded, I'm just not sure how to go about using it for any input. – roldy May 12 '13 at 20:46
-
http://www.ndt.net/article/v05n07/spanner2/fig2.gif Here you have an Image showing the structure of a NN and how EACH of the neurons compute its output. You have to compute the output of each neuron layer by layer until the end. – Ander Biguri May 13 '13 at 07:15
-
So what I could do is use the weight matrix that I made for and just turn of the iteration loop (epochs) and the weight update. The rest of the code should just loop through each neurons weights and performing the rest of the operations smoothly. I'll have to try this tomorrow. Thanks. – roldy May 13 '13 at 07:33