GithubHelp home page GithubHelp logo

jielu-ee / snn-for-finger-velocity-ibmi Goto Github PK

View Code? Open in Web Editor NEW

This project forked from liaorichard/snn-for-finger-velocity-ibmi

0.0 0.0 0.0 24 KB

An Energy-Efficient Spiking Neural Network for Finger Velocity Decoding for Implantable Brain-Machine Interface

License: Other

Python 96.70% MATLAB 3.30%

snn-for-finger-velocity-ibmi's Introduction

Copyright (C) 2022 ETH Zurich, Switzerland. Refer to the file LICENCE.md for information on the license.

An Energy-Efficient Spiking Neural Network for Finger Velocity Decoding for Implantable Brain-Machine Interface

Install needed packages

I Recommend to use conda, you need the following packages installed:

  • pytorch
  • torchvision
  • torchaudio
  • cudatoolkit
  • matplotlib
  • numpy
  • scikit-learn
  • scipy
  • pyyaml

Prepare the dataset:

If you want to use the open source dataset you can simply adapt the prepare_dataset.m file to fit your datastructure and run it using matlab. Otherwise you need to Prepare a .mat file containing the dataset for the SNN to use: It should contain 4 matrices named "X_train", "Y_train", "X_test", "Y_test". The matrices with "..train" in the name should contain the training set data, the matrices with "..test" in the name should countain the test set data. The "X.." meaning input data matrices should have the following shape: [timesteps,electrodes]. For the code to work without modification the number of electrodes has to equal 96. The "Y.." meaning expected output data matrices should have the following shape: [timesteps,(pos_0,vel_0,acc_0,pos_1,vel_1,acc_1)], with pos=position, vel=velocity, acc=acceleration of the two fingers.

Adapt hyperparameter yaml file:

Most parameters are already set to good values, but you probably need to change the "dataset_file" field to the location of the prepared dataset, and choose the locations for the output report and the corresponding plots. You need to make sure that the specified path exists. If you want to test a hyperparameter configuration you should set 5-fold to true. This means that 5-fold validation is used. To test the network 5-fold should be set to false to use the entire training set (including the holdout validation set) for training.

Train and Test

Run the network by calling the main file with python and using the hyperparameter file as the first argument.

$ python main.py hyperparameters.yaml

Look at Results

After python has concluded its operation you can open the file specified at the "output_report" field to look at the results. In this file you also find the "id", which is used to identify the corresponding plots at the location specified at "output_plots"

snn-for-finger-velocity-ibmi's People

Contributors

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