Skip to content

ZackGoldblum/BCI-Motor-Imagery

Repository files navigation

BMES 725 BCI Motor Imagery

This is the code for the BMES 725 term project "Real-time Classification of Motor Imagery Data via an EEG-based Brain Computer Interface" by Zack Goldblum, Dan Thompson, and Adam Wojnar.

In this project we evaluate the validity of three convolutional neural networks (EEGNet, Shallow ConvNet, and Deep ConvNet) for the real-time classification of motor imagery tasks. Adapated verions of these models are from the Army Research Laboratory (ARL) EEGModels project.

The OpenBCI Ultracortex Mark IV and Cyton Biosensing Board were used as the EEG headset and data acquisition board in both the creation of our motor imagery dataset and in our real-time classification program. EEG data was acquired from the 8 electrode channels at a 250 Hz sampling rate with the following 10-20 System locations:

Ch1: F7, Ch2: C3, Ch3: F3, Ch4: P3, Ch5: P4, Ch6: F4, Ch7: C4, Ch8: F8

10-20_locations

Files

  • main_eeg_read.py is the general-purpose file for data acquisition, processing, and saving.
  • model_training.py loads/formats our motor imagery dataset and trains/saves the Shallow ConvNet as a pre-trained model.
  • demo_realtime.py is our real-time motor imagery classification program for EEG data streamed from the OpenBCI headset.
  • get_BCIC_raw_dt.ipynb and models_test_dt.ipynb are the Jupyter Notebook files used to evaluate the three convolutional neural networks trained on the Brain Computer Interface Competition IV 2a dataset.

Datasets

  • Our motor imagery dataset is located in /eeg_data with "left" and "right" sub-directories corresponding to left-hand and right-hand motor imagery tasks.
  • The BCIC IV 2a dataset-related files are located in the /BCIC_IV_2a directory.

Models

  • Various pre-trained models are located in the /models directory.