khengyeww / sym-STDP

Hao's sym-STDP-SNN model
5 stars 0 forks source link
snn spiking-neural-network

Hao's sym-STDP-SNN model

update

Near-replication of Hao's SNN model from this paper using BindsNET.

Requirements

N.B. Versions mentioned above are verified to work together. Other versions might not be compatible.

Setup

Head over to BindsNET and follow their instruction for environment setup.

Alternatively, install the required packages using requirements.txt provided:

pip install -r requirements.txt

Run

Simply run the following command (both training and inference process included in the file):

python main_snn.py

Example of passing optional command-line arguments:

# (--n_neurons [int]): to set number of excitatory, inhibitory neurons
# (--gpu): to use GPU backend for calculation
python main_snn.py --n_neurons 400 --gpu

Run the script with the --help or -h flag for more information.

Models

Results

During inference stage, there's a problem of SL neurons not spiking due to insufficient response towards the input sample, and thus can't infer any label for the input sample. To counter this problem, added a function (named re-input in below table) to re-present samples with increased firing rates (Hz) till SL neurons fires at least a spike. (Similar function for excitatory neurons during training stage.)

Note: This function was not mentioned in the paper.

Below table shows approx. test accuracies for each model with or without the function (named re-input) mentioned above used. Results of 100 excitatory neurons model trained with 1 epoch:

Model w/o re-input (%) w/ re-input (%)
v2 72.53 80.14
v3 81.52 82.09

Citation