Abstract: This project contains the optimized implemention of a Numba-JIT accelerated pythonic implementation of the Kohonen Self Organising Map with user-specified grid matrix size, capable of taking a multispectral satellite image as input and generating a coded image using the trained SOM as a code book. The entire implementation is packaged as a python executable. We also restore the image from its codebook and compare it with original image, and visualize the results with vivid plots.
- Rohan Rajesh Kalbag
- Durgaprasad Bhat
- Siddharth Anand
./generate_executable.ps1
chmod +x generate_executable.sh
./generate_executable.sh
Image formats supported: .png
, .jpg
, .mat
(single image in a single array in x_pixels
* y_pixels
* n_channels
for .mat
)
Selecting Input file: Press the Select Input File
button, use the file navigator to navigate to the required file. Select the file
Selecting destination folder: Press the Select Output Directory
button, use the file navigator to navigate to the folder where the outputs are needed to be stored. Select the folder
Input parameters:
- Length of Kohonen Map (nodes) : positive integer. number of nodes in the Kohonen map in x direction
- Breadth of Kohonen Map (nodes): positive integer. positive integer, number of nodes in the Kohonen map in y direction
- Initial Learning Rate for Training: positive float. Learning rate for the first iteration
- Maximum Number of Iterations: positive integer. The number iteration the models needs to be trained for.
- Neighborhood Function Spread Factor : positive float (Usually less than 1) Larger factor will increase the number of neighbors affected and the degree of effect. Controls the spread of the neighborhood function
Press the Validate
button to check if the given parameters are compatible. If the parameters are compatible, the Generate
button will appear. Press Generate
to start running the algorithm
Please wait till the training completes and the results are generated. The time taken depends on the image type and the input parameters. Do not close the window, it will automatically close once the results are generated. For checking the progress of the training, please see the console (terminal) that will popup behind the GUI.
Outputs:
-
150x150.png
: A downsized version of the input image ($150$ x$150$ pixels) -
coded_image.npy
: A numpy file containing the coded image. Users can import this into their own python code usingnumpy.load()
-
coded_image.txt
: A human readable version of the coded image with the best matching Kohonen cell for each pixel. -
kohonen.png
: The trained Kohonen map visualized as an image -
restored.png
: The final result. The original image reconstructed using the best matching Kohonen map cells.
- Find a detailed analysis of the code, screenshots of the GUI, experiments and inferences in the Presentation
- Input Image (was resized to
$150$ x$150$ )
- Parameters
{
l = 12
b = 12
lr = 0.5
niter = 20
nbf = 0.03
}
- Kohonen Map
- Restored Image
- Input Image (was resized to
$200$ x$200$ )
- Parameters
{
l = 20
b = 35
lr = 0.25
niter = 100
nbf = 0.02083
}
- Kohonen Map
- Restored Image