-
Notifications
You must be signed in to change notification settings - Fork 2
training a net for Euclidean color distance #13
Description
Hi @wpmed92,
I'd like to train a net to return a normalized color distance between two RGB pixels trained [at first] on a simple Euclidean distance with each color component being 0-255:
function colorDist(r1, g1, b1, r2, g2, b2) {
return Math.sqrt(
Math.pow(r2 - r1, 2) +
Math.pow(g2 - g1, 2) +
Math.pow(b2 - b1, 2)
);
}
i'm normalizing the output of this function in the training set by dividing the output by the max colorDist(255,255,255,0,0,0)
. the training set is generated at random for 200 pixel pairs and the net topology is:
network.addLayer(new Layer(6)); //input
network.addLayer(new Layer(3, new activations.tanh())); //hidden layer
network.addLayer(new Layer(1, new activations.tanh())); //output layer
the following are tweaked from your XOR example: https://github.com/wpmed92/backpropaganda/blob/master/src/multi-layer-xor-train.js
// Train
var TRAINING_SIZE = 200;
var trainIterations = 10000
var learningRate = 0.1;
var miniBatchSize = 200;
what i'm getting as output appears pretty random and the net seems to be bucketing values into the same groups (as a classifier would) rather than returning new prediction values. i'm wondering if i would get better results by having 48 binary inputs (24 bits per px * 2 pixels) and/or and have multiple outputs?
i'm new to neural nets, so perhaps this task is not well-suited for feed-forward, or the topology or training set size needs to be massively increased?
thanks for any advice!
Leon