1

I'm trying to train a DistanceNetwork with SOMLearning of MNIST DB (of handwritten digits).

Each image represented as a 28*28 pixels vector (784 cells), and a label of 0-9.

This is the initialization code:

// Create network
network = new DistanceNetwork(28*28, 100 * 100);
// create learning algorithm
SOMLearning trainer = new SOMLearning(network);
// input
double[] input = new double[28*28];

And this is the training cycle basic code:

// Insert image from training set (byte[728])
input = DB.TrainingImages[i].RawImage;
trainer.Run(input);

After the iterations are finished, when I'm trying to Compute images from the Training Set (for a sanity check), I don't get the nearest image (as I think its suppose to be).

For example, in this test:

network.Compute(DB.TrainingImages[i].RawImage);
var win = network.GetWinner();
var nearestImage = network.Layers[0].Neurons[win].Weights;

I'm trying to get the same image vector that was inserted to the network, so nearestImage suppose to be the same image as the computed image. but I can't find a way to get the nearest image, just the winner neuron (with GetWinner() >> The method returns index of the neuron, which weights have the minimum distance from network's input. )

this is an example of the outputs for some 3 imputs from the training set:

enter image description here

enter image description here

enter image description here

So because the output image I got from the weights is not accurate, I can't get the label of the output image,

also I didn't find a way to insert the label to the train method, but it can be done by putting the label at the first index of the vector).

Please help me to figure out how to make it work, there is not much info out there.

References:

http://www.aforgenet.com/framework/docs/html/ec926d74-a319-191e-edbe-ee5d9321f304.htm http://www.aforgenet.com/framework/samples/neuro_som.html

4

0 回答 0