Friday, August 17, 2007

Color SOM

With this article i would like to demostrate the Color SOM (Self Organizing Map)

The basics of this application comes to creating and training a neural network that groups colors with eachother.

The neural network itself is a SOM (Self Organizing Map) or SON (Self Organizing Network) map. It has 3 input nodes, and in this example a 40 by 40 matrix of output nodes. In this network there are no 'hidden' layers.

The architecture looks like this:



We have our input values, (RGB color), in this case 3 inputs, so the input vector is R,G,B (values from 0 to 255)
We also have a feature map of size X and Y, (40 x 40 in my examples)
Every node of this feature map has a feature vector to an input-node.
This is called the feature vector, and every vector has a weight (Wij)

Now if we look to what I fabricated, then we have to initialize the weights of the vectors connecting each input-node to each output-node with gradient values (left pic) or with random values (right pic).



Then I made a data-set where I trained the network with.
In my example i have trained a network with 9 colors, and a one with random colors ( with 1600 unique colors in it).
While the network is training, it is going to adjust the weights of the feature vectors so that a 'grouping' is brought to life (using epoch- and sigmoid functions etc, look in "my links" to find a tutorial on ai-junkie, which is pretty good).

If I initialize the "feature vector-weights" with gradient values
((0,0,0) on the top-left and (255,255,255) on the bottom-right)
then we get, with the same map-size and color inputs offcourse, always the same end-result if the network is fully trained.

Example of training a gradient colormap with 9 colors as input dataset:



Example of training a gradient colormap (40x40) with 1600 unique colors:



If I train the map with random initialization and random colors as inputs,
then I get a simular result.
When I do it with 9 colors and random initialization, then the 9 colors will be on another place each time we (re)train the network.

Now, think about what for use this could have?
The network groups simular colors in the case, bottomline is, that it can group values with each other, I will show you later on a nice example where I used this technique to group pictures with each other in a nice learning environment ;)

I hope I could give you a little more information or insight about is topic, I will surely discuss this later with a little more depth.

If you don't know anything of A.I, then i strongly suggest to take a look at my links, and follow a couple of tutorials, you will be on your way pretty soon.

Regards,

Whizzo

1 comment:

RagiL said...

hello
can i request
the source code??
thx