NeuromorphicProcessorProject / snn_toolbox

Toolbox for converting analog to spiking neural networks (ANN to SNN), and running them in a spiking neuron simulator.
MIT License
360 stars 104 forks source link

Query regarding INI simulator #128

Closed sauravtii closed 1 year ago

sauravtii commented 2 years ago

I tried simulating my convoltional spiking neural network on INI using snntoolbox and it was successful. I just had a couple of questions, so can anyone please answer them ?

  1. Is there any underlying neuromorphic hardware for INI simulator that it uses to carry out the simulation or it just does it using CPU ?
  2. Can I use INI without using SNNtoolbox or in order to use INI I will have to use SNNtoolbox ?
  3. Are there any resources that would tell me the differences between INI and other simulators for spiking neural networks ?
rbodo commented 2 years ago
  1. GPU / CPU
  2. An SNN converted for the INI backend is just a tensorflow DNN with added functionality (such as membrane potential, spike behavior etc). So in principle you can run the resulting graph outside of the toolbox but then you have to take care of the right input encoding and writing your own simulation time loop.
  3. https://snntoolbox.readthedocs.io/en/latest/guide/intro.html
sauravtii commented 2 years ago

Thanks for your response @rbodo. Is it possible to get the power/energy metrics for INI using snntoolbox or by any other way ? Also, can you please tell me how can I convert my SNN to pynn format and simulate it on BrainScaleS using EBRAINS ? I do have access to BrainScaleS via EBRAINS but I am just struggling to simulate my SNN on BrainScaleS. Also, is there any resource that converts the CNN to SNN and then simulates it on BrainScaleS ?

rbodo commented 2 years ago

The toolbox has no power measurement built in for INI. Since it's just a DNN running on GPU, you can use standard benchmarking tools for that.

The toolbox supports pynn but provides link to a BrainScaleS backend. One option would be to run the conversion with nest / Brian2 backend and then use the saved weight files when constructing your model on BrainScaleS directly. These files are just generic connection tables. The toolbox handles the unrolling of the convolution layers into fully-connected layers, and optionally performs weight normalization to improve the SNN accuracy. You should be able to use the resulting connection tables in a network of fully-connected non-leaky integrate-and-fire neurons. You might notice a discrepancy on neuromorphic hardware though because of weight / state quantization.

sauravtii commented 2 years ago

Do you mean SNN in "just a DNN running on GPU" ? Because this code (https://github.com/NeuromorphicProcessorProject/snn_toolbox/blob/master/examples/mnist_keras_INI.py) basically converts the CNN to SNN and then simulates the converted SNN, right ?

Also, is there any converter available in SNN toolbox that justs converts the SNN to pynn format and when I am using BrainScaleS using EBRAINS, I can just build up the model using saved configuration (saved model in the pynn format) and therfore run it on BrainScaleS ? Also, if you know the code or any resource that achieves this thing, can you please share it ?

rbodo commented 2 years ago

Do you mean SNN in "just a DNN running on GPU" ?

Yes, in case of INI sim (see my first answer).

I don't know of a resource that does conversion for Brainscales, and don't know how to "build up the model" in their API. Perhaps best to contact their team.

sauravtii commented 2 years ago

Okay, thank you so much for your help!