Code Monkey home page Code Monkey logo

emg_exp's Introduction

EMG experiments

This is the code for the paper Signals to Spikes for Neuromorphic Regulated Reservoir Computing and EMG Hand Gesture Recognition, available here.

Getting started

Dependencies

  • numpy
  • pandas
  • matplotlib
  • scipy
  • scikit_learn
  • scikit_plot
  • nni
  • seaborn
  • Brian2

Installation

Requirements can be installed with :

pip3 install -r requirements.txt

Please note that the requirement file might use outdated dependencies. To get latest versions :

pip3 install numpy pandas matplotlib scipy scikit_learn scikit_plot nni seaborn Brian2

Finally, make sure the source of the project is in the Python path.

  • On Linux : export PYTHONPATH="$PWD/src"
  • On Windows : set PYTHONPATH="$PWD/src"

You can also modify it permanently : see here.

Usage

Datasets

Different datasets for Electromyography (EMG) are provided in the folder datasets/ :

  • Roshambo (classes: rock, paper, scissor)
  • 5_class (classes: pinky, elle, yo, index, thumb)
  • Pinch (classes: Pinch1, Pinch2, Pinch3, Pinch4)

Pipelines

Spike encoder & Evaluation baseline

This is the first pipeline described in the paper. To execute it :

python3 src/evaluate_encoder.py [options]

Reservoir

This is the second pipeline described in the paper. To execute it :

python3 src/evaluate_reservoir.py [options] 

Parameters

All the parameters are listed and detailed in the file src/args_emg.py. They can be specified as follow :

python3 <<script>> --dataset="5_class" --learning_algorithm="critical" --cbf=1

Scripting

Pipelines can also be used in Python scripts :

import random
import numpy as np
from evaluate_encoder import *
from evaluate_reservoir import *
from args_emg import args as my_args

# Get default arguments 
# Can be modified (eg. args.adaptiveProb = 1)
args = my_args()

# Fix the seed of all random number generator
seed = int(args.seed)
random.seed(seed)
np.random.seed(seed)

# Spike encoding & Evaluation baseline
svm_score_enc,firing_rate_enc,svm_score_baseline_enc = evaluate_encoder(args)

# Reservoir 
lda_score,lda_score_input,svm_linear_score,svm_linear_score_input,svm_score,svm_score_input,firing_rate,nbsynapses,nbneurons = evaluate_reservoir(args)

Reproduce the results

Experiments presented in the paper can be reproduced by executing the files in the folder experiments/. These files are for parameter exploration : a grid search algorithm is used to test different combinations of parameters. Files can be executed with :

python3 -m experiments.experiment_exploration_v10

Best results

Default parameters reproduce the best results presented in the paper. Note that a reservoir with 320 neurons is used for a 3 class problem, and 2048 neurons for a 5 class problem. Hence, for 5_class dataset, macrocolumn shape must be modified to [4,4,4].

Acknowledgements

University of Sherbrooke. NEuro COmputational & Intelligent Signal Processing Research Group (NECOTIS)

emg_exp's People

Contributors

nikhil-garg avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

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