Kim, Y. & Panda, P., Visual explanations from spiking neural networks using inter-spike intervals. Sci Rep 11, 19037 (2021). https://doi.org/10.1038/s41598-021-98448-0
- Python 3.9
- PyTorch 1.10.0
- NVIDIA GPU (>= 12GB)
- CUDA 10.2 (optional)
conda create -n VisualExp
conda activate VisualExp
conda install pytorch torchvision torchaudio cudatoolkit=10.2 -c pytorch
- Download tinyimagenet dataset to
PATH/TO/DATASET
- Train a model using BNTT (https://github.com/Intelligent-Computing-Lab-Yale/BNTT-Batch-Normalization-Through-Time).
- As a first step, download pretrained parameters (link) to
PATH/TO/MODEL.pth.tar
-
The above pretrained model is for TinyImageNet / VGG11 architecture
-
Run the following command
python main.py --pretrainedmodel_pth 'PATH/TO/MODEL' --dataset_pth 'PATH/TO/DATASET' --target_layer 6
-
Heatmaps (across timesteps) are visualized in folder
figuresave
-
In order to change the target images, please change the list in line 32.
Example) visualize 10th and 52th images in TinyImageNet validation dataset.
img_nums = [10, 52]
Please consider citing our paper:
@article{kim2021visual,
title={Visual explanations from spiking neural networks using interspike intervals},
author={Kim, Youngeun and Panda, Priyadarshini},
journal={arXiv preprint arXiv:2103.14441},
year={2021}