Giter Club home page Giter Club logo

som's Introduction

SOM

A lenna image is compressed by vector quantization using Kohonen's Self organizing map. The image is divided into blocks of base size (say 4 x 4) and the corresponding vectors are fed to the SOM. This generates a codebook of a predetermined size which is used to generate the reconstructed image.

Getting Started

Prerequisites

  1. Anaconda for Python 2.7
  2. OpenCV for Python 2.7

Installing

  1. Anaconda for Python 2.7
    Go to the downloads page of Anaconda and select the installer for Python 2.7. Once downloaded, installing it should be a straightforward process. Anaconda has along with it most of the packages we need.

  2. OpenCV for Python 2.7
    This page explains it quite well.

Running

Before running SOM.py, a few parameters are to be set.

image_location
bits_per_codevector
block_width
block_height
epochs
initial_learning_rate

image_location is set to the relative location of the image from the current directory.
bits_per_codevector is set based on the size of the codebook you desire. For e.g., for a 256-vector codebook, this value should be 8 as 2^8 = 256.
block_width and block_height are set to the size of the blocks the image is divided into. Make sure the blocks cover the the entire image.
epochs is the number of epochs this algorithm is to be run.
initial_learning_rate is the learning rate at t = 0.

Once the parameters are decided, enter the following command to run the script.
python [name of the script] [image_location] [bits_per_codevector] [block_width] [block_height] [epochs] [initial_learning_rate]

Please read the wiki for an understanding of the above terms.

Results

For the image compressed using SOM.py, click here.
The following parameters are used.

block_width = 4
block_height = 4
epochs = 3
initial_learning_rate = 0.7

bits_per_codevector ranged from 1 to 10.

som's People

Contributors

droidadroit avatar

Stargazers

 avatar  avatar

Watchers

 avatar

som's Issues

add colors to image not in grey scale

Hello Droidadroit, there is no issue and thank you for the code it is very insightful.
I am trying to compress an image using Kohen/SOM but I'd like to display colors instead of the grey scale. what changes can I make to your program to be able to do that?

thank you

Question

Hello Droidadroit,
How did you reduce the dimension of the image via the SOM?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.