You are here

OCR using MNIST database and FeedForwading Backpropagation trainnig

Hello,
I'm trying to use the feedforwad Backpropagation network but it doesn't work.
I used a similar code used in OCR example from book "Introduction to Neural Networks with Java".
I realy don't know where i'm wrong. I tested with xor table, and 7 segments display table and works well.

I use this function to train.
The image is passed as it is. But the values of pixel are normalized betwheen 0-1.

public void train(double data[][],double label[][]) throws IOException {

System.out.println("Criando rede");
FeedforwardNetwork network = new FeedforwardNetwork();

network.addLayer(new FeedforwardLayer(data[0].length));
network.addLayer(new FeedforwardLayer(label[0].length/2));
network.addLayer(new FeedforwardLayer(data[0].length/2));
network.addLayer(new FeedforwardLayer(label[0].length));
network.reset();

Train train = new Backpropagation(network, data, label,
0.7, 0.9);

int epoch = 1;
System.out.println("Iniciando treinamento");
do {
train.iteration();

System.out .println("Epoch #" + epoch + " Error:" + train.getError());
epoch++;
} while ((epoch < 5000000) && (train.getError() > 0.01));

}

---------------------
The results of training in the console are the same.
Epoch #1 Error:0.31622776601683794
Epoch #2 Error:0.31622776601683794
Epoch #3 Error:0.31622776601683794
Epoch #4 Error:0.31622776601683794
Epoch #5 Error:0.31622776601683794
Epoch #6 Error:0.31622776601683794
Epoch #7 Error:0.31622776601683794
Epoch #8 Error:0.31622776601683794
Epoch #9 Error:0.31622776601683794
Epoch #10 Error:0.31622776601683794
Epoch #11 Error:0.31622776601683794
Epoch #12 Error:0.31622776601683794
Epoch #13 Error:0.31622776601683794
Epoch #14 Error:0.31622776601683794
Epoch #15 Error:0.31622776601683794
Epoch #16 Error:0.31622776601683794
Epoch #17 Error:0.31622776601683794
Epoch #18 Error:0.31622776601683794
Epoch #19 Error:0.31622776601683794

Neural Network Forums: 
Clifte's picture

I found the problem. There were a error in my normalization function. The data to be training wasn't correctly formatted.

Theme by Danetsoft and Danang Probo Sayekti inspired by Maksimer