C230 project: Recurrent Neural Network for brain-machine interfaces: decoding arm kinematics from intracortical signal
CS230 project: Recurrent Neural Network for brain-machine interfaces: decoding arm kinematics from intracortical signal
Authors: Julien Boussard, Maxime Cauchois and Theodor Misiakiewicz
Brain-machine interfaces attempt to translate neural activity into control signals and create a direct pathway between the brain and an external device. In particular, BMIs give hope to impaired patients for communicating via an external computer. The main challenge lies in reliably decoding neural activity, a highly non-linear and noisy time series data, into a particular stimulus. In this project, we build a recurrent neural network to decode covert mental processes of non-human primates from intracortical electrodes. The animals were trained to reach a target on a screen among 48 predefined positions. Our goal is to infer which target the animal plan on reaching from its neural activity. We used data provided by the Stanford Neural Prosthetic System Lab and constructed a RNN model with one LSTM that shows promising performances.
Given the premovement neural activity of 192 neurons monitored for a given period of time, we aim to predict the target attained by the animal in an experiment, among 48 targets divided into three concentric circles.
python build_data.py
1Bis. Data Already processed for tensorflow If your data is already under the format .tfrecords, you only need to put it in the folder data
, and move on to step 2.
Your first experiment We created a base_model
directory for you under the experiments
directory. It countains a file params.json
which sets the parameters for the experiment. It looks like
{
"learning_rate": 1e-3,
"batch_size": 5,
"num_epochs": 2
}
For every new experiment, you will need to create a new directory under experiments
with a params.json
file.
Train your experiment. If your data in in data/my_folder
, simply run
python train.py --model_dir experiments/base_model --data_dir data/my_folder
It will instantiate a model and train it on the training set following the parameters specified in params.json
. It will also evaluate some metrics on the development set, especially the accuracy, the ‘Top 3’ accuracy and so on.
If you want to reuse the weights from a past experiment you can use the --restore_dir
option, precising the folder in which your weights have been saved (generally experiments/my_model/my_weights
), for instance:
python train.py --model_dir experiments/base_model --data_dir data/my_folder --restore_dir experiments/base_model/best_weights
The code architecture was taken from the “Named Entity Recognition with Tensorflow” project by Guillaume Genthial and Olivier Moindrot (see https://cs230-stanford.github.io).