Dr. Xiang Zhang · Prof. Lina Yao
Companion repository for the book: Deep Learning for EEG-based Brain-Computer Interface: Representations, Algorithms and Applications (World Scientific, 2021)
This repository contains implementable Python and Jupyter Notebook code alongside benchmark datasets for learning how to classify brain signals using deep learning. It accompanies our survey on deep learning for noninvasive brain signals and the textbook.
The materials cover:
- A taxonomy of BCI signal paradigms by acquisition method (ECoG, EEG, fNIRS, fMRI, EOG, MEG)
- Core deep learning architectures: MLP, RNN, LSTM, GRU, CNN, AE, VAE, GAN, DBN, GIN
- Guidelines for designing BCI systems across signal categories, models, and applications
- Novel BCI prototypes for authentication, visual reconstruction, language interpretation, and neurological disorder diagnosis
| Distribution on signals | Distribution on DL models |
|---|---|
![]() |
![]() |
Brain signal collection is both financially and temporally costly. We curated 31 public datasets with download links covering most brain signal types:
| Brain Signal | Dataset | Subjects | Classes | Rate (Hz) | Channels | Download |
|---|---|---|---|---|---|---|
| FM ECoG | BCI-C IV, Data set IV | 3 | 5 | 1000 | 48–64 | Link |
| MI ECoG | BCI-C III, Data set I | 1 | 2 | 1000 | 64 | Link |
| Sleeping EEG | Sleep-EDF Telemetry | 22 | 6 | 100 | 2 EEG, 1 EOG, 1 EMG | Link |
| Sleeping EEG | Sleep-EDF Cassette | 78 | 6 | 100/1 | 2 EEG, 1 EOG, 1 EMG | Link |
| Sleeping EEG | MASS-1 | 53 | 5 | 256 | 17/19 EEG, 2 EOG, 5 EMG | Link |
| Sleeping EEG | MASS-3 | 62 | 5 | 256 | 20 EEG, 2 EOG, 3 EMG | Link |
| Sleeping EEG | SHHS | 5804 | N/A | 125/50 | 2 EEG, 1 EOG, 1 EMG | Link |
| Seizure EEG | CHB-MIT | 22 | 2 | 256 | 18 | Link |
| Seizure EEG | TUH | 315 | 2 | 200 | 19 | Link |
| MI EEG | EEGMMIDB | 109 | 4 | 160 | 64 | Link |
| MI EEG | BCI-C IV, Data set II a | 9 | 4 | 250 | 22 EEG, 3 EOG | Link |
| Emotional EEG | AMIGOS | 40 | 4 | 128 | 14 | Link |
| Emotional EEG | SEED | 15 | 3 | 200 | 62 | Link |
| Emotional EEG | DEAP | 32 | 4 | 512 | 32 | Link |
| fMRI | ADNI | 202 | 3 | N/A | N/A | Link |
| fMRI | BRATS | 65 | 4 | N/A | N/A | Link |
We also provide a well-processed, ready-to-use version of the EEGMMIDB dataset (109 subjects, 64 channels, 160 Hz). Each .npy file represents one subject with shape [N, 65]: 64 EEG channel features plus one class label column.
The tutorial notebooks cover the full BCI pipeline: data acquisition, preprocessing, feature extraction, classification, and evaluation. To run the CNN classification example:
python 4-2_CNN.pyFor PyTorch beginners, we recommend Morvan Zhou's PyTorch Tutorials.
Companion code for the book chapters (TensorFlow implementations):
| Chapter | Topic | Repository |
|---|---|---|
| 7 | Adaptive feature learning | know_your_mind |
| 9 | EEG-based user identification (MindID) | MindID |
| 10 | Visual EEG shape reconstruction | EEG_Shape_Reconstruction |
| 11 | Brain typing: EEG to text | Brain_typing |
| 13 | Neurological disorder (seizure) diagnosis | adversarial_seizure_detection |
Python 3.7. Install dependencies with:
pip install -r requirements.txtNote: torch-geometric and its dependencies (cluster, scatter, sparse) require version-specific installation — follow the official guide.
If this repository is useful for your research, please cite the survey or book:
@article{zhang2020survey,
title = {A survey on deep learning-based non-invasive brain signals: recent advances and new frontiers},
author = {Zhang, Xiang and Yao, Lina and Wang, Xianzhi and Monaghan, Jessica JM and Mcalpine, David and Zhang, Yu},
journal = {Journal of Neural Engineering},
year = {2020},
publisher = {IOP Publishing}
}
@book{zhang2021deep,
title = {Deep Learning for EEG-based Brain-Computer Interface: Representations, Algorithms and Applications},
author = {Zhang, Xiang and Yao, Lina},
year = {2021},
publisher = {World Scientific Publishing}
}For questions about the code or tutorial, contact xiang.alan.zhang@gmail.com.
This repository is licensed under CC BY-NC-SA 4.0. Commercial use is prohibited. Derivatives must carry the same license.



