Git Product home page Git Product logo

mm-bp-snn's Introduction

Hybrid Macro/Micro Level Backpropagation for SNNs

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.

Dependencies and Libraries

  • opencv
  • cuda (suggest cuda 8.0)

You can compile the code on windows or linux.

SDK include path(-I)
  • 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)
Library search path(-L)
  • linux: /usr/local/lib/
  • windows: X:/Program Files/opencv/vs2010/install/x86/cv10/lib (Depend on situation)
libraries(-l)
  • opencv_core
  • opencv_highgui
  • opencv_imgproc
  • opencv_imgcodecs (need for opencv3.0)
  • cublas
  • curand
  • cudadevrt

Installation

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
GPU compute compatibility
  • capability 6.0 for Titan XP, which is used for the authors.

Get Dataset

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/

Run the code

  • 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
For Window user

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)

Notes

  • 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.

mm-bp-snn's People

Contributors

zhxfl avatar jinyyy666 avatar liuyxin avatar

Watchers

James Cloos avatar

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.