Need help with hopfield-colors?
Click the “chat” button below for chat support from the developer who created it, or find similar developers for support.

About the developer

mateogianolio
128 Stars 20 Forks Other 33 Commits 0 Opened issues

Description

Trains a Hopfield recurrent neural network to recognize colors and uses it to interpret images.

Services available

!
?

Need anything else?

Contributors list

No Data

Hopfield color recognition

Trains a Hopfield recurrent neural network to recognize colors after which it interprets all PNG images in the

input
folder and saves the results to the
output
folder.

Usage

Clone this repository and make sure the

output
folder exists before running
$ npm install
$ node main.js

Edit the beginning of

main.js
if you want to use different colors.

The transparency of each pixel is based on the uncertainty of the neural network's response to its color.

Observations

  • When trained to recognize red, green, blue and black (
    #ff0000
    ,
    #00ff00
    ,
    #0000ff
    and
    #000000
    respectively), the inverses cyan, yellow and magenta (
    #00ffff
    ,
    #ff00ff
    and
    #ffff00
    respectively) emerge as solid states as noted in the 'Spurious patterns' section of the Wikipedia article.
  • Applying a network trained to recognize black and white (
    #000000
    and
    #ffffff
    respectively) on a circular color spectrum produces fractal-like patterns.

Examples

Below are a few examples of Hopfield networks trained to remember different combinations of colors. Think of the output as a reflection of what the network "sees" when interpreting the input.

Black and white

The following images are inputs and outputs of a network which recognizes black and white (

#000000
and
#ffffff
respectively) colors.

Input

Output
Input circular spectrum Output circular spectrum
Input linear spectrum Output linear spectrum
Input canonical spectrum Output canonical spectrum
Input nature image Output nature image

Green and black

The following images are inputs and outputs of a network which recognizes green and black (

#ff0000
and
#000000
respectively) colors.

Input

Output
Input circular spectrum Output circular spectrum
Input linear spectrum Output linear spectrum
Input canonical spectrum Output canonical spectrum
Input nature image Output nature image

Red, green, blue and black

The following images are inputs and outputs of a network which recognizes red, green, blue and black (

#ff0000
,
#00ff00
,
#0000ff
and
#000000
respectively) colors.

Input

Output
Input circular spectrum Output circular spectrum
Input linear spectrum Output linear spectrum
Input canonical spectrum Output canonical spectrum
Input nature image Output nature image

Contribute

Feel free to fork and submit pull requests.

We use cookies. If you continue to browse the site, you agree to the use of cookies. For more information on our use of cookies please see our Privacy Policy.