/Code-SBLEST

Matlab code for SBLEST algorithm

Primary LanguagePython

Code-SBLEST

This repo contains Matlab and Python code for the SBLEST (Sparse Bayesian Learning for End-to-End Spatio-Temporal-Filtering-Based Single-Trial EEG Classification) algorithm, as well as implementations of Convolutional Neural Networks (CNNs) used in the paper. Detailed information about the algorithms and CNN implementations can be found in W. Wang, F. Qi, D. Wipf, C. Can, T. Yu, Z. Gu, Y. Li, Z. Yu, W. Wu. Sparse Bayesian Learning for End-to-End EEG Decoding, IEEE Transactions on Pattern Analysis and Machine Intelligence, vol. 45, no. 12, pp. 15632-15649, 2023.

Data

The data used in this repository is from Subject L1 (foot vs. tongue) in Dataset II, as mentioned in the referenced paper.

File Descriptions

Matlab code for SBLEST

The MATLAB scripts provided in this section implement the SBLEST algorithm and have been tested with MATLAB R2018b.

File Descriptions

  • SBLEST.m —Matlab code for the SBLEST algorithm.

  • SBLEST_main.m — An example code for classifying single-trial EEG data using SBLEST in Matlab.

Usage

  1. To run the code, download and extract them into a folder of your choice, and navigate to this folder within MATLAB.

  2. At the MATLAB command line, type

SBLEST_main

Python code for SBLEST

The Python scripts for SBLEST are implemented in PyTorch and have been fully tested with Python 3.9.

File Descriptions

  • SBLEST_model.py —Python code for the SBLEST algorithm.

  • SBLEST_main.py — An example code for classifying single-trial EEG data using SBLEST in Python.

Python Implementations of sCNN, dCNN, EEGNet, EEG-Inception, and EEGSym

sCNN and dCNN are implemented in PyTorch using the braindecode package, which is provided at https://github.com/robintibor/braindecode.

EEGNet is implemented in TensorFlow using the Keras API, with the model provided at https://github.com/vlawhern/arl-eegmodels.

EEG-inception and EEGSym are also implemented in TensorFlow, with the models provided at https://github.com/esantamariavazquez/EEGInception and https://github.com/Serpeve/EEGSym, respectively.

File Descriptions

  • sCNN_main.py — An example code for classifying single-trial EEG data using sCNN.

  • dCNN_main.py — An example code for classifying single-trial EEG data using dCNN.

  • EEGNet_main.py — An example code for classifying single-trial EEG data using EEGNet.

  • EEGModels.py — A model file used in the EEGNet implementation.

  • EEGInception_main.py — An example code for classifying single-trial EEG data using EEG-inception.

  • EEGInception.py — A model file used in the EEG-inception implementation.

  • EEGSym_main.py — An example code for classifying single-trial EEG data using EEGSym.

  • EEGSym_architecture.py — A model file used in the EEGSym implementation.

  • EEGSym_DataAugmentation.py — A python file for data augmentation used in the EEGSym implementation.

  • signal_target.py — A code for preprocessing the signal and target used in all the cNNs implementations.