nabilalibou / online_bci_mi

Real-Time BCI for Rock-Paper-Scissors: Decoding Motor Imagery with Minimal Training

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Real-Time Brain-Computer Interface for Rock-Paper-Scissors

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.

Approach:

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.

Experimental Setup:

  • 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:

Offline Analysis

Preprocessing

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.

Feature extraction

(Details to be added)

Classifiers

(Details on chosen algorithms to be added).

Classification Scores

(Results of offline classification - intra-subject & inter-subject - to be added).

Online Analysis:

Preprocessing

(Details to be added)

Feature extraction

(Details to be added)

Classifiers

(Details on chosen algorithms to be added).

Classification Scores

(Results of offline classification - intra-subject & inter-subject - to be added).

Getting Started:

Clone the repository and install the dependencies:

git clone https://github.com/nabilalibou/online_bci_mi.git
pip install -r requirements.txt

Video/Gif:

(To be added - demonstrate online preprocessing and classification)

About

Real-Time BCI for Rock-Paper-Scissors: Decoding Motor Imagery with Minimal Training

License:MIT License


Languages

Language:Python 100.0%