I'm trying to train neural network to do some image processing. I successfully did it with Synaptic.js, but it learns terribly slow when I have to use more layers. Tensorflow.js samples describe some specific cases and it's hard to understand them and apply to my case. Could anybody help me with converting this Synaptic.js code into Tensorflow.js? Input is a 3x3 (or more) kernel of RGB pixels [0..1] and output is a single RGB pixel [0..1]
const layers = [27, 9, 3];
const learningRate = 0.05;
const perceptron = new Synaptic.Architect.Perceptron(layers);
// Train
sampleData.forEach(([input, output]) => {
perceptron.activate(input);
perceptron.propagate(learningRate, output);
});
// Get result
const result = realData.map((input) => perceptron.activate(input));
There are some very generic TensorFlow.js examples in the examples repo: https://github.com/tensorflow/tfjs-examples
For your case you will need to do something like the iris example in that repo.