Code Monkey home page Code Monkey logo

lm-snn's Introduction

Unsupervised Handwritten Digit Classification using Spiking Neural Networks and Spike Timing-Dependent Plasticity

This repository contains the code for the plasticity and learning project in the BINDS laboratory at UMass Amherst.

Our code is built on Peter Diehl's research code and his work with Matthew Cook at ETH Zurich, from the paper Unsupervised learning of digit recognition using spike-timing-dependent plasticity.

Setting Things Up

First things first, download the MNIST handwritten digit dataset by running the bash script entitled get_MNIST.sh found in the data folder. You can run this file by entering ./get_MNIST.sh in the terminal; if you don't have permission to, execute chmod +x get_MNIST.sh.

Important: Make sure to change your matplotlibrc file (typically located in ~/.config/matplotlib/; if it's not there, you can create it) to include the line backend : Qt5Agg. Otherwise, you may not be able to import pylab while importing brian 1.4.3. The default backend, GKAgg, will not work with this outdated module!

Clone this repository to a directory of your choice, denoted by <stdp-mnist>. We recommend that your install Anaconda2 and make it your default Python, via adding the line export PATH=[path to anaconda]/bin:$PATH to your .bashrc (for *nix systems), as this will make installing the appropriate packages easier. Change directory into <stdp-mnist>, and execute pip install -r requirements.txt in a terminal (on *nix systems) or a Git Bash shell (on Windows), and then execute conda install --file conda_requirements.txt.

Running the Code

To train a network, change directory into <stdp-mnist>/code/train, and choose one of the scripts therein to train a spiking neural network model on the MNIST handwritten digit dataset. We recommend you train a convolutional spiking neural network with between-patch connectivity (CSNN-PC), which is the most general model in that it can be reduced to a convolutional spiking neural network without between-patch connectivity (CSNN) or simply the spiking neural network model (SNN) from the above paper in certain special cases. To do so, simply run

python csnn_pc_mnist.py

to train a CSNN-PC model with default parameters. To see a list of optional arguments to specify on the command line, run

python csnn_pc_mnist.py --help

Perhaps the most useful command-line argument is do_plot, which, when set as do_plot=True, allows you to visualize network training progress, learned convolution filters and between-patch connection weights, current input to the network, and the distribution of "votes" (i.e., individual excitatory neuron classifications) over the last minibatch (update_interval) of data.

There are various supporting scripts in other subfolders of the project repository which allow a user to test or visualize parameters of trained models, plot performance curves, and run jobs on the CICS swarm2 high performance computing cluster. As the project is currently under heavy development, much of the code is fragmented, disorganized, and / or broken, but the state of things will hopefully improve as the project develops.

Team Members

lm-snn's People

Contributors

danjsaund avatar peggyyyy avatar jessegoodspeed avatar hananel-hazan avatar dsanghavi 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.