This repository explores the development of a real-time Brain-Computer Interface (BCI) capable of classifying motor execution and motor imagery tasks using EEG signals. The ultimate goal is to create a rock-paper-scissors game controlled by BCI using minimal training data.
The project arose from a desire to compete in various games using BCI technology. We aimed to develop a system that accurately classifies different limb movements using only 50 training samples per condition.
This study is divided into two parts:
Offline Analysis: This phase involves preprocessing and classification of recorded EEG signals to identify optimal algorithms for real-time processing.
Online Analysis: This phase implements the chosen algorithms in a real-time BCI system using MNE-lsl for online classification and control.
- Subjects: Two right-handed participants (me and my colleague).
- Tasks: Three motor execution (ME) and three motor imagery (MI) tasks, each focused on a different limb (left arm, right arm, right leg).
- Data Acquisition: 32-channel EEG system (TMSI) with 2064 Hz sampling rate using a standard 10/20 electrode montage.
- Protocol: Each session consisted of an initial resting state followed by 50 repetitions of a sequence combining ME and MI tasks as illustrated in the diagram below:
The raw EEG data undergoes various steps to remove artifacts and noise, including:
- Re-referencing to an average reference montage.
- Removing mastoid channels.
- Band-pass filtering (2 Hz - 50 Hz) with zero-phase response.
- ICA for artifact rejection with automatic component labeling using MNE-ICALabel.
- Automatic bad channel detection & removal with spherical spline interpolation for reconstruction.
- Epoching (-0.15s to 5s around each event-task).
- Baseline correction.
- Automatic bad epoch rejection using Autoreject.
(Details to be added)
(Details on chosen algorithms to be added).
(Results of offline classification - intra-subject & inter-subject - to be added).
(Details to be added)
(Details to be added)
(Details on chosen algorithms to be added).
(Results of offline classification - intra-subject & inter-subject - to be added).
Clone the repository and install the dependencies:
git clone https://github.com/nabilalibou/online_bci_mi.git
pip install -r requirements.txt
(To be added - demonstrate online preprocessing and classification)