Coder Social home page Coder Social logo

biclab / asa-snn Goto Github PK

View Code? Open in Web Editor NEW
24.0 1.0 3.0 398 KB

Offical implementation of "Inherent Redundancy in Spiking Neural Networks" (ICCV2023)

Home Page: https://openaccess.thecvf.com/content/ICCV2023/html/Yao_Inherent_Redundancy_in_Spiking_Neural_Networks_ICCV_2023_paper.html

License: Apache License 2.0

Python 98.68% Shell 1.32%
attention-mechanism dynamic-neural-network redundancy spiking-neural-networks

asa-snn's Introduction

Inherent Redundancy in Spiking Neural Networks ICCV2023

Spiking Neural Networks (SNNs) are well known as a promising energy-efficient alternative to conventional artificial neural networks. Subject to the preconceived impression that SNNs are sparse firing, the analysis and optimization of inherent redundancy in SNNs have been largely overlooked, thus the potential advantages of spike-based neuromorphic computing in accuracy and energy efficiency are interfered. In this work, we pose and focus on three key questions regarding the inherent redundancy in SNNs. We argue that the redundancy is induced by the spatio-temporal invariance of SNNs, which enhances the efficiency of parameter utilization but also invites lots of noise spikes. Further, we analyze the effect of spatio-temporal invariance on the spatio-temporal dynamics and spike firing of SNNs. Then, motivated by these analyses, we propose an Advance Spatial Attention (ASA) module to harness SNNs' redundancy, which can adaptively optimize their membrane potential distribution by a pair of individual spatial attention sub-modules. In this way, noise spike features are accurately regulated. Experimental results demonstrate that the proposed method can significantly drop the spike firing with better performance than state-of-the-art baselines.

abstract

Our module's details are in ./models/module/Attn.py.

train & test

requirements

  • python >= 3.7
  • torch >= 1.10
  • torchvision >= 0.11
  • spikingjelly == 0.0.0.0.12
  • h5py
  • pandas
  • einops
  • seaborn: only for plot features
  • torchinfo: only for see the details of networks

quick-start

sh final.sh

train on your own dataset

CUDA_VISIBLE_DEVICES=0 python3 train_test.py                   \
    -arch A                     \
    -T 60                       \
    -attention ASA              \
    -dataset yourdata           \
    -data_path DATA_PATH        \
    -batch_size_train 32        \
    -batch_size_test 4          \
    -clip 10                    \
    -num_epochs 200             \
    -seed 0                     \
    -ps 00011

args' helper

python3 train_test.py -h
  1. arch: A for three-layer SNN; B for five-layer SNN
  2. T: the time steps you want to set
  3. attention: the module you want to use, "no" or "ASA" in this project
  4. dataset: the dataset you want to use
  5. data_path: the path of your dataset
  6. batch_size_train / test: the batch-size used in training and inference
  7. clip: the times you want to set for data augments algorithm "RCS"
  8. num_epochs: the epochs you want to set
  9. seed: the random seed you want to set
  10. ps: the dropput is on / off on different layers

configs' details could be seen in ./config.py

performance

Dataset Model Acc.(%) NASFR
DVS128 Gesture LIF-SNN 91.3 0.176
. + ASA 95.2(+3.9) 0.038(-78.4%)
DVS128 Gesture by spikingjelly LIF-SNN-Five 95.5 0.023
. + ASA 97.7(+2.2) 0.018(-21.7%)
DVS128 Gait-day LIF-SNN 88.6 0.214
. + ASA 93.6(+5.0) 0.045(-78.9%)
DVS128 Gait-night LIF-SNN 96.4 0.197
. + ASA 98.6(+2.2) 0.126(-36.0%)
DailyAction-DVS LIF-SNN 92.5 0.017
. + ASA 94.6(+2.1) 0.013(-23.5%)
HAR-DVS SEW-Res-SNN-18 45.5 0.206
. + ASA 47.1(+1.6) 0.183(-11.2%)

Citation

@inproceedings{yao2023inherent,
  title={Inherent Redundancy in Spiking Neural Networks},
  author={Yao, Man and Hu, Jiakui and Zhao, Guangshe and Wang, Yaoyuan and Zhang, Ziyang and Xu, Bo and Li, Guoqi},
  booktitle={Proceedings of the IEEE/CVF International Conference on Computer Vision},
  pages={16924--16934},
  year={2023}
}

Contact Information

For help or issues using this git, please submit a GitHub issue.

For other communications related to this git, please contact [email protected] and [email protected].

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.