Show HN: Neural network color recognition(github.com)
github.com
Show HN: Neural network color recognition
https://github.com/mateogianolio/hopfield-color-filter
4 comments
Interesting but how is a NN necessary instead of examining pixel values?
I haven't looked at this code, but as a guess, a good NN could learn color names rather than having them explicitly defined, it could learn to compensate for lighting and white balance in photos, and it could recognize which color in a multi-color scene is the "main" color.
I would assume it's a practical (although not entirely useful) example of a hopfield network. If you look at the wikipedia page for it[1] there is little to no information on what you would use it for, seeing an example of practical usage is great for figuring out other practical applications for a hopfield network.
[1]:http://en.wikipedia.org/wiki/Hopfield_network
[1]:http://en.wikipedia.org/wiki/Hopfield_network
You're right, it's just a practical application.
For those interested, I came across this chapter [1], which is great for learning about hopfield networks.
[1]: http://www.cs.toronto.edu/~mackay/itprnn/ps/506.522.pdf
For those interested, I came across this chapter [1], which is great for learning about hopfield networks.
[1]: http://www.cs.toronto.edu/~mackay/itprnn/ps/506.522.pdf
It reminds me of the brain.js color contrast demo (https://harthur.github.io/brain/). Perhaps it was inspired by that.
Yeah, I really don't think so, maybe an SVM would be more adequate for this case?
It's pretty much linear and 3-dimensional (r, g, b values) you don't need a complicated structure to read that
It's pretty much linear and 3-dimensional (r, g, b values) you don't need a complicated structure to read that
Good stuff.
quick q: why do you call this a hopfield network? I see you have a fully connected 2 layer neural network (0 hidden layers): https://github.com/mateogianolio/hopfield-color-recognition/...
instead of a bunch of circularly connected perceptrons: http://en.wikipedia.org/wiki/Hopfield_network#mediaviewer/Fi...
p.s. it looks like the library you're using has a built in Hopfield network `new Architect.Hopfield(10)` (at the bottom: [here](https://www.npmjs.com/package/synaptic)), why didn't you use this?
quick q: why do you call this a hopfield network? I see you have a fully connected 2 layer neural network (0 hidden layers): https://github.com/mateogianolio/hopfield-color-recognition/...
instead of a bunch of circularly connected perceptrons: http://en.wikipedia.org/wiki/Hopfield_network#mediaviewer/Fi...
p.s. it looks like the library you're using has a built in Hopfield network `new Architect.Hopfield(10)` (at the bottom: [here](https://www.npmjs.com/package/synaptic)), why didn't you use this?
Thanks.
To answer your first question, I (perhaps naively) assumed that the synaptic library used correct naming for its network prototypes [1].
My implementation contains a few modifications to the one defined as 'Architect.Hopfield' [2], which is why I decided to put it in a separate file. It also helps a visitor to know how the network is defined without needing to browse the source of the synaptic library.
[1]: https://github.com/cazala/synaptic/blob/master/README.md#hop...
[2]: https://github.com/cazala/synaptic/blob/master/src/architect...
To answer your first question, I (perhaps naively) assumed that the synaptic library used correct naming for its network prototypes [1].
My implementation contains a few modifications to the one defined as 'Architect.Hopfield' [2], which is why I decided to put it in a separate file. It also helps a visitor to know how the network is defined without needing to browse the source of the synaptic library.
[1]: https://github.com/cazala/synaptic/blob/master/README.md#hop...
[2]: https://github.com/cazala/synaptic/blob/master/src/architect...
I don't get it. If you trained to recognize black and white, why did it find such a complex pattern where there were clearly none in the first example? Isn't it an example that it failed?
Interesting stuff, nice work!
The complex pattern is a result of the network doing the equivalent of fitting 3 gaussians (1 for each of RGB color channel) on the intensity of the pixel in that channel. I was curious, so I recorded a tiny demo of doing the equivalent piecewise in photoshop: http://cl.ly/183Z3w1V1B0F
Posterization in photoshop is a k-means technique, and each k-mean is a center of a gaussian, hence my motivation for the analogue video.
The triangles in the thresholded image make me think that the network is doing the equivalent of predicting a probability that a certain pixel is white/black per channel, and then these channels collude for the final decision, and thus we see triangles when the intersections of the 3 triangly spaced gaussians yield a value above some threshold.
Pic of the different channels: http://cl.ly/image/1w371V3U0N02
The complex pattern is a result of the network doing the equivalent of fitting 3 gaussians (1 for each of RGB color channel) on the intensity of the pixel in that channel. I was curious, so I recorded a tiny demo of doing the equivalent piecewise in photoshop: http://cl.ly/183Z3w1V1B0F
Posterization in photoshop is a k-means technique, and each k-mean is a center of a gaussian, hence my motivation for the analogue video.
The triangles in the thresholded image make me think that the network is doing the equivalent of predicting a probability that a certain pixel is white/black per channel, and then these channels collude for the final decision, and thus we see triangles when the intersections of the 3 triangly spaced gaussians yield a value above some threshold.
Pic of the different channels: http://cl.ly/image/1w371V3U0N02
Great analysis, I hope you don't mind my linking to this comment as an explanation of the fractal patterns in the readme?
It sure is an interesting output, which is why I put it under 'observations'. For every color (24-bit binary) the network receives it has to output either black or white, which it does, so I wouldn't call it a failure.