EEGSym original Keras 8-channel weights converted to PyTorch
This repository contains a PyTorch state_dict converted from the original
Keras EEGSym_pretrained_weights_8_electrode.h5 checkpoint for the 8-electrode
EEGSym configuration.
The checkpoint targets the faithful PyTorch port in:
replicability.eegsym_faithful.FaithfulEEGSym
It is not a drop-in checkpoint for the current upstream braindecode.models.EEGSym
topology. The upstream model is structurally close, but it differs from the
authors' released Keras architecture in enough places that the original weights
cannot be loaded 1:1 without an architecture-compatibility path.
Expected Input
- Shape:
(batch, 8, 384) - Sampling rate: 128 Hz
- Canonical channel order:
F3, C3, P3, Cz, Pz, F4, C4, P4 - Output: 2 logits
Verification
- Keras H5 SHA256:
f60ddd220cf48dd18dd9706c5389c70a244fe878610021c2ed97d40105145b2b - State values excluding
num_batches_tracked:144440 - Trainable parameters:
142784 - H5 datasets consumed:
146/146 - PyTorch tensors filled:
146/146 - Forward probe output shape:
(2, 2) - Source replicability commit:
a76ee9bf66204b4ebd07746aeb48933dd4272daa
Loading
import torch
from replicability.eegsym_faithful import FaithfulEEGSym
model = FaithfulEEGSym(n_chans=8, n_outputs=2, n_times=384)
state_dict = torch.load("pytorch_model.bin", map_location="cpu")
model.load_state_dict(state_dict)
model.eval()
Provenance
The original Keras checkpoint was obtained from the authors' EEGSym reference code mirrored under the replicability evidence tree:
research/evidence/source_code_repos/EEGSym/EEGSym/EEGSym_pretrained_weights_8_electrode.h5
This conversion only changes tensor layout from Keras/HDF5 conventions to the faithful PyTorch module layout; it does not retrain or modify the learned values.
Training data
The data that shaped these weights. The ids are the datasets: field of this card,
which braindecode reads into model.card_data.datasets when you call
from_pretrained (MOABB class names for MOABB datasets, OpenNeuro / NEMAR
accessions, Hub ids otherwise). nm/on ids are datasets on NEMAR
(on = NEMAR's copy of the OpenNeuro dataset with the same number). Rows marked
private: are data the authors did not release; they are not in datasets:.
datasets: id |
Dataset | Stage | Modality |
|---|---|---|---|
on004362 |
PhysioNet EEG Motor Movement/Imagery Dataset (EEGMMIDB), MOABB PhysionetMI | pretraining | EEG |
nm000338 |
Lee et al. 2019 OpenBMI, motor imagery paradigm (54 subjects, 62 EEG channels), MOABB Lee2019_MI | pretraining | EEG |
Kaya2018 |
Kaya et al. 2018 large EEG motor imagery dataset (Scientific Data), MOABB Kaya2018 (NEMAR nm000137 holds a subset of it) | pretraining | EEG |
Meng2019 |
Meng et al. 2019 motor imagery dataset (Front. Hum. Neurosci. 13:128); not in MOABB | pretraining | EEG |
nm000339 |
Stieger et al. 2021 mindfulness/BCI motor imagery dataset (62 subjects), MOABB Stieger2021 | pretraining | EEG |
- Supervised left- vs right-hand motor-imagery pre-training of EEGSym (8 electrodes F3, C3, P3, Cz, Pz, F4, C4, P4; 128 Hz, 3 s) on 5 public datasets totalling 280 users. OpenBMI = MOABB Lee2019_MI. The conversion did not retrain.
- Sources: https://github.com/Serpeve/EEGSym README.md; Pérez-Velasco et al. 2022, IEEE TNSRE, doi:10.1109/TNSRE.2022.3186442, abstract (Europe PMC PMID 35759578); Pérez-Velasco et al. 2022 abstract; https://huggingface.co/braindecode/eegsym-original-keras-8ch-pytorch/resolve/main/keras_h5_sha256.txt.
Cite Braindecode
If you use this braindecode port in scientific work, cite the software on Zenodo, doi:10.5281/zenodo.17699192, and the original model and datasets cited above.
@software{braindecode,
author = {Aristimunha, Bruno and
Guetschel, Pierre and
Wimpff, Martin and
Gemein, Lukas and
Rommel, Cedric and
Banville, Hubert and
Sliwowski, Maciej and
Wilson, Daniel and
Brandt, Simon and
Gnassounou, Théo and
Paillard, Joseph and
{Junqueira Lopes}, Bruna and
Sedlar, Sara and
Moreau, Thomas and
Chevallier, Sylvain and
Gramfort, Alexandre and
Schirrmeister, Robin Tibor},
title = {Braindecode: toolbox for decoding raw electrophysiological brain data
with deep learning models},
url = {https://github.com/braindecode/braindecode},
doi = {10.5281/zenodo.17699192},
publisher = {Zenodo},
license = {BSD-3-Clause},
}
- Downloads last month
- 65