A unified codebase for fine-tuning and evaluation of biosignal models.
Benchmarking is currently supported for the following models:
- EEGNet: braindecode
- EEGInception: braindecode
- LaBraM: github
- NeuroGPT: github
- CBraMod: github
- BIOT: github
- EEGPT: github
- MIRepNet: github
Install PyTorch.
Install other requirements:
pip install -r requirements.txt
The following 5 EEG datasets are selected for benchmarking:
| Dataset | Paradigm | Number of Classes | Type(s) | Tasks |
|---|---|---|---|---|
| High Gamma | Executed Movement | 4 | no_action, left_fist, right_fist, both_feet |
|
| OpenBMI-ERP | ERP | 2 | target, nontarget |
|
| Pavlov 2022 | Working Memory | 2 | 13_digits |
memory, control |
| Sleep-EDF | Sleep Stage | 6 | Sleep stage W, Sleep stage 1, Sleep stage 2, Sleep stage 3, Sleep stage 4, Sleep stage R |
|
| PhysioNet | Eyes Open-Closed | 2 | eye_open, eye_closed |
The following pre-processing should be applied to the raw EEG signals for each dataset:
- resampled to sample frequency for the selected model
- bandpass filter as needed for the selected model
- notch filtered at 50Hz, 60Hz and harmonics (if not already excluded with bandpass)
- cut into trials:
- High Gamma: 0s-4s after each cue
- OpenBMI-ERP: 0.2s before - 0.8s after each cue
- Pavlov 2022: 14s-18s after each 13 digits trial cue (corresponding to the peak in pupil size reported in the dataset publication)
- Sleep-EDF: 30s epochs from the original continuous recording, and discard any data from the awake condition except for the 30 minutes before and after sleep
- PhysioNet: 4s epochs from the original continuous recording (only runs 1 and 2)
- saved in numpy format as an array with shape (N_trials, Channels, Time)
For compatability with our data loading functions, metadata about each dataset should be saved as a pandas DataFrame where each row corresponds to a single trial
- each row should contain the subject ID
- each row should give the 'task' or 'type' of the trial
- the attributes of the file should include the list of channel names
The PTB-XL dataset is currently used for ECG benchmarking, with labels for 5, 23 or 43 classes.
The script automates the download of the PTB-XL ECG dataset, executes preprocessing pipelines and formats the data for downstream classification tasks
python preprocessing_ecg_ptb_xl.py
Once data has been pre-processed to the expected format and saved under {DATA_PATH}, the benchmarking script can be run as below:
python main.py \
--data-root={DATA_PATH} \
--batch-size=64 \
--n-epochs=100 \
--model-name='EEGNetv1' \
--output-dir='results'
Alternatively the bash script finetune.sh can be run which has our minimal configuration and can also take the experiment ID number for ClearML as an argument e.g.
source finetune.sh 123
By default this will run training/fine-tuning on the whole model, unless the --train_head_only argument is added to freeze the pre-trained model.
By default, the mode is set to 'benchmark' which will run cross-fold validation and return metrics.
To run training on the whole dataset and save the finetuned model, set --mode='finetune' in the bash script.
The ECG and EEG benchmarks are introduced and described in the following publication:
@article{Lee_2025,
title={A Comprehensive Review of Biosignal Foundation Models},
url={http://dx.doi.org/10.36227/techrxiv.176369849.97173246/v1},
DOI={10.36227/techrxiv.176369849.97173246/v1},
publisher={Institute of Electrical and Electronics Engineers (IEEE)},
author={Lee, Na and Barmpas, Konstantinos and Koliousis, Alexandros and Panagakis, Yannis and Adamos, Dimitrios and Laskaris, Nikolaos and Zafeiriou, Stefanos},
year={2025},
month=nov }
The EEG benchmark was originally introduced and detailed in the following publication:
@inproceedings{
lee2025assessing,
title={Assessing the Capabilities of Large Brainwave Foundation Models},
author={Na Lee and Stylianos Bakas and Konstantinos Barmpas and Yannis Panagakis and Dimitrios Adamos and Nikolaos Laskaris and Stefanos Zafeiriou},
booktitle={IEEE International Workshop on Machine Learning for Signal Processing (MLSP) 2025, Special Sessions},
year={2025},
url={https://openreview.net/forum?id=Qwn2a1uIpx}
}