Welcome! This repo aims to achieve simple contemporary deep transfer learning for EEG analysis, specifically brain-computer interface (BCI) applications.
The official implementation of our paper T-TIME: Test-Time Information Maximization Ensemble for Plug-and-Play BCIs
(IEEE TBME, 2023)
News: The implementation for CR and DPL (our papers currently under review) will be updated once when the papers are accepted. They are all implemented under this identical framework for easier reproduction.
Install Conda dependencies based on environment.yml
file.
To download datasets, run
sh prepare_data.sh
We have provided the source models (baseline source-combined EA+EEGNet) under ./runs, but feel free to train them from scratch.
To train your own source models, run
sh train.sh
or
python ./tl/dnn.py
Note that such source models serve as EEGNet baselines, and are also used in SFUDA and TTA approaches as the initializations. So to save time for TTA/SFUDA for target subject adaptation, it is better to have them ready first.
Note also that we did not provide non-EA models, and please change code accordingly for TTA approaches under train_target() function when loading pretrained weights.
To test the T-TIME algorithm, run
sh test.sh
or
python ./tl/ttime.py
Other approaches can be executed in a similar way. Run any of
python ./tl/*.py
for its corresponding results.
Note that ensemble is seperated. For ensemble results, after running T-TIME, run
python ./tl/ttime_ensemble.py
For the machine learning approaches without neural network models, e.g., CSP. Run
python ./ml/feature.py
Most hyperparameters/configurations of approaches/experiments are under the args variable in the "main" function of each file, and naming should be self-explanatory.
Please contact me at syoungli@hust.edu.cn or lsyyoungll@gmail.com for any questions regarding the paper, and use Issues for any questions regarding the code.
If you find this repo helpful, please cite our work:
@Article{Li2024,
author = {Li, Siyang and Wang, Ziwei and Luo, Hanbin and Ding, Lieyun and Wu, Dongrui},
journal = {IEEE Transactions on Biomedical Engineering},
title = {{T}-{TIME}: Test-Time Information Maximization Ensemble for Plug-and-Play {BCI}s},
year = {2024},
number = {2},
pages = {423-432},
volume = {71},
doi = {10.1109/TBME.2023.3303289},
}
All credit of the base framework goes to Wen Zhang
, do check out the Negative Transfer
project.