mohanhanmo / TMSEEG

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

REMOVING TMS ARTIFACTS FROM EEG RECORDINGS USING A DEEP BIDIRECTIONAL LSTM ARCHITECTURE

Transcranial magnetic stimulation (TMS) is a noninvasive brain stimulation technique in which a time-varying (shortpulse) magnetic field is used to cause electric current to flowin a small region of the brain via electromagnetic induction,thus stimulating new neural activity or modulating ongoing activity. Electroencephalography (EEG) is then used to monitor this brain activity response to TMS cortical stimulation.

The combination has become a promising tool for measuring and even intervening in cortical function, for example asessing the connection between the primary motor cortex and a muscle to diagnose damage from stroke, movement disordersand motor neuron disease, or optimizing TMS treatment fordepression. The major drawback of EEG measurement ofTMS effects is that there is a relatively long lasting artifacts generated by TMS impulse that has an amplitude that is muchlarger than brain activity measeured by the EEG.

This makesit very difficult to evaluate EEG in the critical first 20ms after the TMS pulse. Despite many years of work on artifact mitigation, existing solutions (extracting independent sources with ICA, applying an offline Kalman filter and simply appying sample-and-hold method) have significant drawbacks.

This project demonstrates a novel method to characterize and remove the long lasting TMS artifacts efficiently using a specific recurrent neural network (RNN) architecture, specifically a Long Short-Term Memory (LSTM) network. The neural network architecture implemented for this project uses an input layer of size 3, all fully connected to the hidden layers and hidden layers are fully connected to a denselayer that returns an output. Before fed to the network the input data is normalized, since LSTMs are sensitive to the scale of the input data, especially when the activation function used is sigmoid (default) or tanh. The network estimates the intensity of TMS artifacts after inverting the outputs back to the original scale of inputs. First bidirectional hidden layer contains 16 and the second bidirectional hidden layer contains 8 memory blocks. All LSTM blocks use sigmoid function for activation. Model is compiled using Adam optimizer with a decaying learning rate initialized as 0.001 and mean square error as an objective function.

Since the dataset per EEG channel is composed of only 30 TMS stimulations, in order to avoid the network’s possible proneness to overfitting, the model is validated with 10-fold cross validation. Our method uses 2 batches to reduce the cost of computation and 300 epochs, at which the RMS error is observed to converge.

About


Languages

Language:Python 100.0%