AForge.NET

  :: AForge.NET Framework :: Articles :: Forums ::

recognize manuscript characters, cuestion

The forum is to discuss topics from different artificial intelligence areas, like neural networks, genetic algorithms, machine learning, etc.

recognize manuscript characters, cuestion

Postby jarain78 » Thu Oct 20, 2011 6:39 am

hi evereyone,

I´m working in a project in which I have to recognize manuscript characters. I alredy have the data corpus in this case are the numbers from 0 to 9,
they are in bmp format. Then I do the processing and resize de 16x16. I convert the image in a vector of 256 Which I introduce to my network neuronal.

The enter vector is 1x256

The exit is this array

double[][] output = new double[10][] {new double[]{ 1d, 0d, 0d, 0d, 0d, 0d, 0d, 0d, 0d, 0d },
new double[]{ 0d, 1d, 0d, 0d, 0d, 0d, 0d, 0d, 0d, 0d },
new double[]{ 0d, 0d, 1d, 0d, 0d, 0d, 0d, 0d, 0d, 0d },
new double[]{ 0d, 0d, 0d, 1d, 0d, 0d, 0d, 0d, 0d, 0d },
new double[]{ 0d, 0d, 0d, 0d, 1d, 0d, 0d, 0d, 0d, 0d },
new double[]{ 0d, 0d, 0d, 0d, 0d, 1d, 0d, 0d, 0d, 0d },
new double[]{ 0d, 0d, 0d, 0d, 0d, 0d, 1d, 0d, 0d, 0d },
new double[]{ 0d, 0d, 0d, 0d, 0d, 0d, 0d, 1d, 0d, 0d },
new double[]{ 0d, 0d, 0d, 0d, 0d, 0d, 0d, 0d, 1d, 0d },
new double[]{ 0d, 0d, 0d, 0d, 0d, 0d, 0d, 0d, 0d, 1d }
};


I train my network first for the number 0 using 90 samples and left the number 9 to make the test. When I introduce the image test which went convert
to a vector 1x256 I have a problem. With the number 0 is fine but when I introduce other number like 5 for example, is the same result of using 0.

This is the fragment of my network code:


private BackpropagationNetwork Caracteres_Network;
LinearLayer inputLayer = new LinearLayer(257);
SigmoidLayer hiddenLayer = new SigmoidLayer(10);
SigmoidLayer outputLayer = new SigmoidLayer(10);

// Conecamos las capa de entrada con la capa intermedia
// y la intermedia con las de salida
new BackpropagationConnector(inputLayer, hiddenLayer);
new BackpropagationConnector(hiddenLayer, outputLayer);

Caracteres_Network = new BackpropagationNetwork(inputLayer, outputLayer);

Caracteres_Network.SetLearningRate(learningRate);

TrainingSet trainingSet = new TrainingSet(257, 10);

trainingSet.Add(new TrainingSample(Rna_In,output[0]));
jarain78
 
Posts: 6
Joined: Sun Oct 09, 2011 8:58 pm

Re: recognize manuscript characters, cuestion

Postby andrew.kirillov » Thu Oct 20, 2011 8:44 am

Hello,

jarain78 wrote:I train my network first for the number 0 using 90 samples and left the number 9 to make the test. When I introduce the image test which went convert
to a vector 1x256 I have a problem. With the number 0 is fine but when I introduce other number like 5 for example, is the same result of using 0

Not sure I understood the issue completely ... So you train your network using character '0' only (using different samples of it) and when it is done you provide character '5' to it and expect some useful output? Or?
With best regards,
Andrew


Interested in supporting AForge.NET Framework?
User avatar
andrew.kirillov
Site Admin, AForge.NET Developer
 
Posts: 3446
Joined: Fri Jan 23, 2009 9:12 am
Location: UK

Re: recognize manuscript characters, cuestion

Postby jarain78 » Sat Oct 22, 2011 9:59 pm

Hi, yes you rigth
My Project is about detecting handwritting numbers. I alredy have the images corpus. For each number (from 0 to 9) there is 100 images for a total of 1000 images. I take the image and make it a resize of 16x16 then I convert it to a 256 vector. The vector is saved in a txt file where a keep all my vectors of size 1x256.
Now when I want to train I only call mi txt file and train my neural network. But there is a couple of questions :
1. I read my txt file and show the vector this way:
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,0,0, 0,0,0,0,0,0,0,0,0,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0, 1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0

This is de number zero (0), but it is in string formar and the TrainingSample instruction only recive double format, What can I do to convert the string format to double ?
2. I have to train the net number by number . First the number 0 then number 1 until number 9. Now what I want is that the user write the number on a touch screem and then the neural network Classify the number.
3. Could the AForge.net instruction work in windows xp? Or only in windows CE?
Thanks
jarain78
 
Posts: 6
Joined: Sun Oct 09, 2011 8:58 pm

Re: recognize manuscript characters, cuestion

Postby andrew.kirillov » Mon Oct 24, 2011 4:33 am

jarain78 wrote:2. I have to train the net number by number . First the number 0 then number 1 until number 9. Now what I want is that the user write the number on a touch screem and then the neural network Classify the number.

No, you need to train your network to recognze all numbers. On each training epoch you provide all your numbers from the training set. Then you check learning error and if it is not small enough you start enother epoch, where you provide all numbers to the network again. And so on.
With best regards,
Andrew


Interested in supporting AForge.NET Framework?
User avatar
andrew.kirillov
Site Admin, AForge.NET Developer
 
Posts: 3446
Joined: Fri Jan 23, 2009 9:12 am
Location: UK




Return to Artificial Intelligence