Home

Awesome

Convert Images to Poissonian Spikes

Convert your image data to a Poisson spike source to be able to use with Spiking Neural Networks.

<div align="center"> <table> <tr> <td> <img src="images/pumpkins.jpeg" alt="Pumpkins-RGB" height="120"> </td> <td> &rarr; </td> <td> <img src="images/pumpkins_gray.jpeg" alt="Pumpkins-GrayScale" height="120"> </td> <td> &rarr; </td> <td> <img src="images/spikes_plot_pumpkins.png" alt="Pumpkins-SpikesPlot" height="135"> </td> </tr> </table> </div> <i> The parameters below are used when running <a href="convert_image_to_spike_array.py">convert_image_to_spike_array.py</a> in order to turn <a href="https://unsplash.com/photos/KnZDAYgRsz8">pumpkins</a> above into a spike array. <br> max_freq = 60000 (Hz) <br> on_duration = 10000 (ms) <br> off_duration = 5000 (ms) </i>

Requirements

I use Python 3.5.2 on Linux, necessary packages are listed below along with their versions for reference.

Run pip install -r requirements.txt to install them all.

Project Files and Their Usage

images-to-spikes/
├── convert_image_to_spike_array.py
├── draw_image.py
├── images
│   ├── cross.png
│   ├── horizontal_line_10x.png
│   ├── horizontal_lines.png
│   └── t10k-images-idx3-ubyte__idx_000__lbl_7_.png
├── poisson_tools.py
└── util_functions.py

convert_image_to_spike_array.py is the main file.

draw_image.py enables you to draw your own images by adding simple shapes into it via OpenCV. For more information please see the file.

images folder contains three of the images that I generated by using draw_image.py, and one example from MNIST dataset (t10k-images-idx3-ubyte__idx_000__lbl_7_.png).

poisson_tools.py is where the Poisson distribution modelling takes place.

util_functions.py includes utility functions of files and images.

References and Citation

I only used the Poissonian spikes approach to obtain spike arrays from images in this project. The original project also contains Focal Rank Code Order approach in this sense.

Please refer to the original project's Wiki page for further information.