syedumaramin / EEG-DL

A Deep Learning library for EEG Tasks (Signals) Classification, based on TensorFlow.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool


Welcome to EEG Deep Learning Library

EEG-DL is a Deep Learning (DL) library written by TensorFlow for EEG Tasks (Signals) Classification. It provides the latest DL algorithms and keeps updated.

License Python 3 TensorFlow 1.13.1

Documentation

The supported models include

No. Model Codes
1 Deep Neural Networks DNN
2 Convolutional Neural Networks [Paper] [Tutorial] CNN
3 Deep Residual Convolutional Neural Networks [Paper] ResNet
4 Thin Residual Convolutional Neural Networks [Paper] Thin ResNet
5 Densely Connected Convolutional Neural Networks [Paper] DenseNet
6 Fully Convolutional Neural Networks [Paper] FCN
7 One Shot Learning with Siamese Networks (CNNs Backbone) [Paper] [Tutorial] Siamese Networks
8 Graph Convolutional Neural Networks [Paper] [Presentation] [Tutorial] GCN / Graph CNN
9 Deep Residual Graph Convolutional Neural Networks ResGCN
10 Densely Connected Graph Convolutional Neural Networks DenseGCN
11 Recurrent Neural Networks [Paper] RNN
12 Attention-based Recurrent Neural Networks [Paper] RNN with Attention
13 Bidirectional Recurrent Neural Networks [Paper] BiRNN
14 Attention-based Bidirectional Recurrent Neural Networks [Paper] BiRNN with Attention
15 Long-short Term Memory [Paper] LSTM
16 Attention-based Long-short Term Memory [Paper] LSTM with Attention
17 Bidirectional Long-short Term Memory [Paper] BiLSTM
18 Attention-based Bidirectional Long-short Term Memory [Paper] BiLSTM with Attention
19 Gated Recurrent Unit [Paper] GRU
20 Attention-based Gated Recurrent Unit [Paper] GRU with Attention
21 Bidirectional Gated Recurrent Unit [Paper] BiGRU
22 Attention-based Bidirectional Gated Recurrent Unit [Paper] BiGRU with Attention

One EEG Motor Imagery (MI) benchmark is currently supported. Other benchmarks in the field of EEG or BCI can be found here.

No. Dataset
1 EEG Motor Movement/Imagery Dataset [Tutorial]

The evaluation criteria consists of

Evaluation Metrics
Confusion Matrix [Tutorial]
Accuracy / Precision / Recall / F1 Score / Kappa Coefficient [Tutorial]
Receiver Operating Characteristic (ROC) Curve / Area under the Curve (AUC)
Paired-wise t-test (via R language [Tutorial])

The evaluation metrics are mainly supported for four-class classification. If you wish to switch to two-class or three-class classification, please modify this file to adapt to your personal Dataset classes. Meanwhile, the details about the evaluation metrics can be found in this paper.

Usage Demo: EEG Motor Movement/Imagery Dataset

  1. Download the EEG Motor Movement/Imagery Dataset via this script.

    (Under Any Python Environment)$ python MIND_Get_EDF.py
    
  2. Read the .edf files (One of the raw EEG signals formats) and save them into Matlab .m files via this script. FYI, this script must be executed under the Python 2 environment (Python 2.7 is recommended) due to some Python 2 syntax. If using Python 3 environment to run the file, there might be no error, but the labels of EEG tasks would be totally messed up.

    (Under Python 2.7 Environment)$ python Extract-Raw-Data-Into-Matlab-Files.py
    
  3. Preprocessed the Dataset via the Matlab and save the data into the Excel files (training_set, training_label, test_set, and test_label) via these scripts with regards to different models. FYI, every lines of the Excel file is a sample, and the columns can be regarded as features, e.g., 4096 columns mean 64 channels X 64 time points. Later, the models will reshape 4096 columns into a Matrix with the shape 64 channels X 64 time points. You should can change the number of columns to fit your own needs, e.g., the real dimension of your own Dataset.

  4. Train and test deep learning models under the Python 3.6 Environment (Highly Recommended) for EEG signals / tasks classification via the EEG-DL library, which provides multiple SOTA DL models.

    Python Version: Python 3.6 (Recommended)
    TensorFlow Version: TensorFlow 1.13.1
    

    Use the below command to install TensorFlow GPU Version 1.13.1:

    pip install --upgrade --force-reinstall tensorflow-gpu==1.13.1 --user
    
  5. Read evaluation criterias (through iterations) via the Tensorboard. You can follow this tutorial. When you finished training the model, you will find the "events.out.tfevents.***" in the folder, e.g., "/Users/shuyuej/Desktop/trained_model/". You can use the following command in your terminal:

    tensorboard --logdir="/Users/shuyuej/Desktop/trained_model/" --host=127.0.0.1
    

    You can open the website in the Google Chrome (Highly Recommended).

    http://127.0.0.1:6006/
    

    Then you can read and save the criterias into Excel .csv files.

  6. Finally, draw beautiful paper photograph using Matlab or Python. Please follow these scripts.

Notice

  1. I have tested all the files (Python and Matlab) under the macOS. Be advised that for some Matlab files, several Matlab functions are different between Windows Operating System (OS) and macOS. For example, I used "readmatrix" function to read CSV files in the MacOS. However, I have to use “csvread” function in the Windows because there was no such "readmatrix" Matlab function in the Windows. If you have met similar problems, I recommend you to Google or Baidu them. You can definitely work them out.

  2. The Loss Function can be changed or modified from this file.

  3. The Dataset Loader can be changed or modified from this file.

Citation

If you find our library useful, please considering citing our paper in your publications. We provide a BibTeX entry below.

@article{hou2019novel,  
    year = 2020,  
    month = {feb},  
    publisher = {IOP Publishing},  
    volume = {17},  
    number = {1},  
    pages = {016048},  
    author = {Yimin Hou and Lu Zhou and Shuyue Jia and Xiangmin Lun},  
    title = {A novel approach of decoding {EEG} four-class motor imagery tasks via scout {ESI} and {CNN}},  
    journal = {Journal of Neural Engineering}  
}

@inproceedings{Lun2020GCNs,
    title={GCNs-Net: A Graph Convolutional Neural Network Approach for Decoding Time-resolved EEG Motor Imagery Signals},
    author={Xiangmin Lun and Shuyue Jia and Yimin Hou and Yan Shi and Yang Li and Hanrui Yang and Shu Zhang and Jinglei Lv},
    year={2020}
}

@inproceedings{Hou2020DeepFM,
    title={Deep Feature Mining via Attention-based BiLSTM-GCN for Human Motor Imagery Recognition},
    author={Yimin Hou and Shuyue Jia and Shu Zhang and Xiangmin Lun and Yan Shi and Yang Li and Hanrui Yang and Rui Zeng},
    year={2020}
}

Contribution

We always welcome contributions to help make EEG-DL Library better. If you would like to contribute or have any question, please feel free to contact me, and my email is shuyuej@ieee.org.

Organizations

The library was created and open-sourced by Shuyue Jia, supervised by Prof. Yimin Hou @ Human Sensor Laboratory, School of Automation Engineering, Northeast Electric Power University, Jilin, China.

About

A Deep Learning library for EEG Tasks (Signals) Classification, based on TensorFlow.

License:MIT License


Languages

Language:Python 87.9%Language:MATLAB 12.1%