This repo is the CUDA implementation of SNNs trained the hybrid macro/micro level backpropagation, modified based on zhxfl for spiking neuron networks.
The paper Hybrid Macro/Micro Level Backpropagation for Training Deep Spiking Neural Networks is accepted by NeurIPS 2018.
Contact [email protected] if you have any questions or concerns.
- opencv
- cuda (suggest cuda 8.0)
You can compile the code on windows or linux.
- linux: /usr/local/cuda/samples/common/inc/ (For include file "helper_cuda"); /usr/local/include/opencv/ (Depend on situation)
- windows: X:/Program Files (x86) /NVIDIA Corporation/CUDA Samples/v6.5/common/inc (For include file "helper_cuda"); X:/Program Files/opencv/vs2010/install/include (Depend on situation)
- linux: /usr/local/lib/
- windows: X:/Program Files/opencv/vs2010/install/x86/cv10/lib (Depend on situation)
- opencv_core
- opencv_highgui
- opencv_imgproc
- opencv_imgcodecs (need for opencv3.0)
- cublas
- curand
- cudadevrt
The repo requires CUDA 8.0+ to run.
Please install the opencv and cuda before hand.
Install CMake and OpenCV
$ sudo apt-get install cmake libopencv-dev
Checkout and compile the code:
$ git clone https://github.com/jinyyy666/mm-bp-snn.git
$ cd mm-bp-snn
$ mkdir build
$ cd build
$ cmake ..
$ make -j
- capability 6.0 for Titan XP, which is used for the authors.
Get the MNIST dataset:
$ cd mm-bp-snn/mnist/
$ ./get_mnist.sh
Get the N-MNIST dataset by the link. Then unzip the ''Test.zip'' and ''Train.zip''.
Run the matlab code: NMNIST_Converter.m in nmnist/
- MNIST
$ cd mm-bp-snn
$ ./build/CUDA-SNN 6 1
- N-MNIST
$ cd mm-bp-snn
$ ./build/CUDA-SNN 7 1
- For Spiking-CNN, you need to enable the #define SPIKING_CNN in main.cpp, and recompile.
$ cd mm-bp-snn
$ ./build/CUDA-SNN 6 1
Do the following to set up compilation environment.
- Install Visual Stidio and OpenCV.
- When you create a new project using VS, You can find NVIDIA-CUDA project template, create a cuda-project.
- View-> Property Pages-> Configuration Properties-> CUDA C/C++ -> Device-> Code Generation-> compute_60,sm_60
- View-> Property Pages-> Configuration Properties-> CUDA C/C++ -> Common-> Generate Relocatable Device Code-> Yes(-rdc=true)
- View-> Property Pages-> Configuration Properties-> Linker-> Input-> Additional Dependencies-> libraries(-l)
- View-> Property Pages-> Configuration Properties-> VC++ Directories-> General-> Library search path(-L)
- View-> Property Pages-> Configuration Properties-> VC++ Directories-> General-> Include Directories(-I)
- The SNNs are implemented in terms of layers. User can config the SNNs by using configuration files in Config/
- The program will save the best test result and save the network weight in the file "Result/checkPoint.txt", If the program exit accidentally, you can continue the program form this checkpoint.
- The log for the reported performance of the three datasets and the correspoding checkout point files can be found in Result folder.