A new model for robust and accelerated training of single-spike spiking neural networks (SNNs) with competitive performance across various image and neuromorphic datasets. This is the accompanying repository to the paper Robust and accelerated single-spike spiking neural network training with applicability to challenging temporal tasks.
Install all required dependencies and activate the block environment using conda.
conda env create -f environment.yml
conda activate block
See the notebooks/Tutorial.ipynb notebook for getting started with the block model.
All the paper results can be reproduced using the scripts available in the scripts
folder. Alternatively, all speedup benchmarks and pretrained models can be found under the releases.
The python run_benchmarks.py
script will benchmark the time of the forward and backward passes of the block and standard single-spike SNN model for different numbers of neurons and simulation steps.
Ensure that the computer has a CUDA capable GPU with CUDA 11.0 installed.
The Fashion-MNIST dataset will be downloaded by PyTorch by default. The content of the Neuromorphic-MNIST dataset can be downloaded and unzipped into the data/N-MNIST
directory. Thereafter, the python convert_nmnist2h5.py
script (taken from Perez-Nieves et al., 2021) needs to be run which processes the raw dataset. Finally, the Spiking Heidelberg Digits (SHD) dataset can be downloaded and unzipped into the data/SHD
directory.
You can train the block and standard single-spike SNN on the different datasets using the train.py script. As an example, see the scripts/run_robustness.py
script.
All speedup and training results can be built by running the notebooks/results/benchmark_results.ipynb
and notebooks/results/dataset_results.ipynb
notebooks. The code for the other paper figures can be found under notebooks/figures
directory.
Training speedup of our model over the standard model. a. Total training speedup as a function of the number of hidden neurons
Analysis of our models performance on real datasets. a. Difference in accuracy between the standard multi-spike and our model. b. Training speedup of our model vs the standard single-spike model. c. Reduction in spikes of our single-spike model vs the standard multi-spike model (a-c use a