Braindecode 1.2.0.dev175267687__tar.gz → 1.2.0.dev175337561__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {braindecode-1.2.0.dev175267687/braindecode.egg-info → braindecode-1.2.0.dev175337561}/PKG-INFO +2 -7
- {braindecode-1.2.0.dev175267687 → braindecode-1.2.0.dev175337561}/braindecode/models/__init__.py +8 -6
- {braindecode-1.2.0.dev175267687 → braindecode-1.2.0.dev175337561}/braindecode/models/atcnet.py +1 -1
- {braindecode-1.2.0.dev175267687 → braindecode-1.2.0.dev175337561}/braindecode/models/attentionbasenet.py +20 -23
- {braindecode-1.2.0.dev175267687 → braindecode-1.2.0.dev175337561}/braindecode/models/ctnet.py +1 -1
- {braindecode-1.2.0.dev175267687 → braindecode-1.2.0.dev175337561}/braindecode/models/deep4.py +2 -6
- {braindecode-1.2.0.dev175267687 → braindecode-1.2.0.dev175337561}/braindecode/models/deepsleepnet.py +5 -118
- {braindecode-1.2.0.dev175267687 → braindecode-1.2.0.dev175337561}/braindecode/models/eegconformer.py +12 -15
- {braindecode-1.2.0.dev175267687 → braindecode-1.2.0.dev175337561}/braindecode/models/eeginception_erp.py +7 -76
- {braindecode-1.2.0.dev175267687 → braindecode-1.2.0.dev175337561}/braindecode/models/eeginception_mi.py +0 -2
- {braindecode-1.2.0.dev175267687 → braindecode-1.2.0.dev175337561}/braindecode/models/eegnet.py +189 -25
- {braindecode-1.2.0.dev175267687 → braindecode-1.2.0.dev175337561}/braindecode/models/eegnex.py +6 -113
- braindecode-1.2.0.dev175337561/braindecode/models/eegresnet.py +362 -0
- {braindecode-1.2.0.dev175267687 → braindecode-1.2.0.dev175337561}/braindecode/models/eegsimpleconv.py +0 -2
- {braindecode-1.2.0.dev175267687 → braindecode-1.2.0.dev175337561}/braindecode/models/eegtcnet.py +1 -1
- {braindecode-1.2.0.dev175267687 → braindecode-1.2.0.dev175337561}/braindecode/models/sccnet.py +8 -79
- {braindecode-1.2.0.dev175267687 → braindecode-1.2.0.dev175337561}/braindecode/models/shallow_fbcsp.py +0 -2
- {braindecode-1.2.0.dev175267687 → braindecode-1.2.0.dev175337561}/braindecode/models/sleep_stager_blanco_2020.py +0 -2
- {braindecode-1.2.0.dev175267687 → braindecode-1.2.0.dev175337561}/braindecode/models/sleep_stager_chambon_2018.py +0 -2
- braindecode-1.2.0.dev175267687/braindecode/models/attn_sleep.py → braindecode-1.2.0.dev175337561/braindecode/models/sleep_stager_eldele_2021.py +2 -12
- {braindecode-1.2.0.dev175267687 → braindecode-1.2.0.dev175337561}/braindecode/models/sparcnet.py +0 -2
- {braindecode-1.2.0.dev175267687 → braindecode-1.2.0.dev175337561}/braindecode/models/summary.csv +41 -39
- {braindecode-1.2.0.dev175267687 → braindecode-1.2.0.dev175337561}/braindecode/models/tidnet.py +0 -2
- {braindecode-1.2.0.dev175267687 → braindecode-1.2.0.dev175337561}/braindecode/models/tsinception.py +3 -15
- {braindecode-1.2.0.dev175267687 → braindecode-1.2.0.dev175337561}/braindecode/models/usleep.py +9 -103
- {braindecode-1.2.0.dev175267687 → braindecode-1.2.0.dev175337561}/braindecode/models/util.py +5 -5
- braindecode-1.2.0.dev175337561/braindecode/version.py +1 -0
- {braindecode-1.2.0.dev175267687 → braindecode-1.2.0.dev175337561/braindecode.egg-info}/PKG-INFO +2 -7
- {braindecode-1.2.0.dev175267687 → braindecode-1.2.0.dev175337561}/braindecode.egg-info/SOURCES.txt +4 -16
- {braindecode-1.2.0.dev175267687 → braindecode-1.2.0.dev175337561}/braindecode.egg-info/requires.txt +0 -5
- {braindecode-1.2.0.dev175267687 → braindecode-1.2.0.dev175337561}/docs/api.rst +11 -16
- {braindecode-1.2.0.dev175267687 → braindecode-1.2.0.dev175337561}/docs/conf.py +17 -39
- {braindecode-1.2.0.dev175267687 → braindecode-1.2.0.dev175337561}/docs/index.rst +3 -3
- braindecode-1.2.0.dev175337561/docs/models_summary.rst +134 -0
- {braindecode-1.2.0.dev175267687 → braindecode-1.2.0.dev175337561}/docs/sg_execution_times.rst +63 -66
- {braindecode-1.2.0.dev175267687 → braindecode-1.2.0.dev175337561}/docs/whats_new.rst +0 -5
- {braindecode-1.2.0.dev175267687 → braindecode-1.2.0.dev175337561}/pyproject.toml +5 -11
- braindecode-1.2.0.dev175267687/braindecode/datasets/experimental.py +0 -218
- braindecode-1.2.0.dev175267687/braindecode/version.py +0 -1
- braindecode-1.2.0.dev175267687/docs/models/categorization/attention.rst +0 -31
- braindecode-1.2.0.dev175267687/docs/models/categorization/channel.rst +0 -31
- braindecode-1.2.0.dev175267687/docs/models/categorization/convolution.rst +0 -33
- braindecode-1.2.0.dev175267687/docs/models/categorization/filterbank.rst +0 -31
- braindecode-1.2.0.dev175267687/docs/models/categorization/gnn.rst +0 -30
- braindecode-1.2.0.dev175267687/docs/models/categorization/interpretable.rst +0 -31
- braindecode-1.2.0.dev175267687/docs/models/categorization/llm.rst +0 -31
- braindecode-1.2.0.dev175267687/docs/models/categorization/recurrent.rst +0 -31
- braindecode-1.2.0.dev175267687/docs/models/categorization/spd.rst +0 -31
- braindecode-1.2.0.dev175267687/docs/models/models.rst +0 -78
- braindecode-1.2.0.dev175267687/docs/models/models_categorization.rst +0 -201
- braindecode-1.2.0.dev175267687/docs/models/models_table.rst +0 -191
- braindecode-1.2.0.dev175267687/docs/models/models_visualization.rst +0 -31
- {braindecode-1.2.0.dev175267687 → braindecode-1.2.0.dev175337561}/LICENSE.txt +0 -0
- {braindecode-1.2.0.dev175267687 → braindecode-1.2.0.dev175337561}/MANIFEST.in +0 -0
- {braindecode-1.2.0.dev175267687 → braindecode-1.2.0.dev175337561}/NOTICE.txt +0 -0
- {braindecode-1.2.0.dev175267687 → braindecode-1.2.0.dev175337561}/README.rst +0 -0
- {braindecode-1.2.0.dev175267687 → braindecode-1.2.0.dev175337561}/braindecode/__init__.py +0 -0
- {braindecode-1.2.0.dev175267687 → braindecode-1.2.0.dev175337561}/braindecode/augmentation/__init__.py +0 -0
- {braindecode-1.2.0.dev175267687 → braindecode-1.2.0.dev175337561}/braindecode/augmentation/base.py +0 -0
- {braindecode-1.2.0.dev175267687 → braindecode-1.2.0.dev175337561}/braindecode/augmentation/functional.py +0 -0
- {braindecode-1.2.0.dev175267687 → braindecode-1.2.0.dev175337561}/braindecode/augmentation/transforms.py +0 -0
- {braindecode-1.2.0.dev175267687 → braindecode-1.2.0.dev175337561}/braindecode/classifier.py +0 -0
- {braindecode-1.2.0.dev175267687 → braindecode-1.2.0.dev175337561}/braindecode/datasets/__init__.py +0 -0
- {braindecode-1.2.0.dev175267687 → braindecode-1.2.0.dev175337561}/braindecode/datasets/base.py +0 -0
- {braindecode-1.2.0.dev175267687 → braindecode-1.2.0.dev175337561}/braindecode/datasets/bbci.py +0 -0
- {braindecode-1.2.0.dev175267687 → braindecode-1.2.0.dev175337561}/braindecode/datasets/bcicomp.py +0 -0
- {braindecode-1.2.0.dev175267687 → braindecode-1.2.0.dev175337561}/braindecode/datasets/bids.py +0 -0
- {braindecode-1.2.0.dev175267687 → braindecode-1.2.0.dev175337561}/braindecode/datasets/mne.py +0 -0
- {braindecode-1.2.0.dev175267687 → braindecode-1.2.0.dev175337561}/braindecode/datasets/moabb.py +0 -0
- {braindecode-1.2.0.dev175267687 → braindecode-1.2.0.dev175337561}/braindecode/datasets/nmt.py +0 -0
- {braindecode-1.2.0.dev175267687 → braindecode-1.2.0.dev175337561}/braindecode/datasets/sleep_physio_challe_18.py +0 -0
- {braindecode-1.2.0.dev175267687 → braindecode-1.2.0.dev175337561}/braindecode/datasets/sleep_physionet.py +0 -0
- {braindecode-1.2.0.dev175267687 → braindecode-1.2.0.dev175337561}/braindecode/datasets/tuh.py +0 -0
- {braindecode-1.2.0.dev175267687 → braindecode-1.2.0.dev175337561}/braindecode/datasets/xy.py +0 -0
- {braindecode-1.2.0.dev175267687 → braindecode-1.2.0.dev175337561}/braindecode/datautil/__init__.py +0 -0
- {braindecode-1.2.0.dev175267687 → braindecode-1.2.0.dev175337561}/braindecode/datautil/serialization.py +0 -0
- {braindecode-1.2.0.dev175267687 → braindecode-1.2.0.dev175337561}/braindecode/datautil/util.py +0 -0
- {braindecode-1.2.0.dev175267687 → braindecode-1.2.0.dev175337561}/braindecode/eegneuralnet.py +0 -0
- {braindecode-1.2.0.dev175267687 → braindecode-1.2.0.dev175337561}/braindecode/functional/__init__.py +0 -0
- {braindecode-1.2.0.dev175267687 → braindecode-1.2.0.dev175337561}/braindecode/functional/functions.py +0 -0
- {braindecode-1.2.0.dev175267687 → braindecode-1.2.0.dev175337561}/braindecode/functional/initialization.py +0 -0
- {braindecode-1.2.0.dev175267687 → braindecode-1.2.0.dev175337561}/braindecode/models/base.py +0 -0
- {braindecode-1.2.0.dev175267687 → braindecode-1.2.0.dev175337561}/braindecode/models/biot.py +0 -0
- {braindecode-1.2.0.dev175267687 → braindecode-1.2.0.dev175337561}/braindecode/models/contrawr.py +0 -0
- {braindecode-1.2.0.dev175267687 → braindecode-1.2.0.dev175337561}/braindecode/models/eegitnet.py +0 -0
- {braindecode-1.2.0.dev175267687 → braindecode-1.2.0.dev175337561}/braindecode/models/eegminer.py +0 -0
- {braindecode-1.2.0.dev175267687 → braindecode-1.2.0.dev175337561}/braindecode/models/fbcnet.py +0 -0
- {braindecode-1.2.0.dev175267687 → braindecode-1.2.0.dev175337561}/braindecode/models/fblightconvnet.py +0 -0
- {braindecode-1.2.0.dev175267687 → braindecode-1.2.0.dev175337561}/braindecode/models/fbmsnet.py +0 -0
- {braindecode-1.2.0.dev175267687 → braindecode-1.2.0.dev175337561}/braindecode/models/hybrid.py +0 -0
- {braindecode-1.2.0.dev175267687 → braindecode-1.2.0.dev175337561}/braindecode/models/ifnet.py +0 -0
- {braindecode-1.2.0.dev175267687 → braindecode-1.2.0.dev175337561}/braindecode/models/labram.py +0 -0
- {braindecode-1.2.0.dev175267687 → braindecode-1.2.0.dev175337561}/braindecode/models/msvtnet.py +0 -0
- {braindecode-1.2.0.dev175267687 → braindecode-1.2.0.dev175337561}/braindecode/models/signal_jepa.py +0 -0
- {braindecode-1.2.0.dev175267687 → braindecode-1.2.0.dev175337561}/braindecode/models/sinc_shallow.py +0 -0
- {braindecode-1.2.0.dev175267687 → braindecode-1.2.0.dev175337561}/braindecode/models/syncnet.py +0 -0
- {braindecode-1.2.0.dev175267687 → braindecode-1.2.0.dev175337561}/braindecode/models/tcn.py +0 -0
- {braindecode-1.2.0.dev175267687 → braindecode-1.2.0.dev175337561}/braindecode/modules/__init__.py +0 -0
- {braindecode-1.2.0.dev175267687 → braindecode-1.2.0.dev175337561}/braindecode/modules/activation.py +0 -0
- {braindecode-1.2.0.dev175267687 → braindecode-1.2.0.dev175337561}/braindecode/modules/attention.py +0 -0
- {braindecode-1.2.0.dev175267687 → braindecode-1.2.0.dev175337561}/braindecode/modules/blocks.py +0 -0
- {braindecode-1.2.0.dev175267687 → braindecode-1.2.0.dev175337561}/braindecode/modules/convolution.py +0 -0
- {braindecode-1.2.0.dev175267687 → braindecode-1.2.0.dev175337561}/braindecode/modules/filter.py +0 -0
- {braindecode-1.2.0.dev175267687 → braindecode-1.2.0.dev175337561}/braindecode/modules/layers.py +0 -0
- {braindecode-1.2.0.dev175267687 → braindecode-1.2.0.dev175337561}/braindecode/modules/linear.py +0 -0
- {braindecode-1.2.0.dev175267687 → braindecode-1.2.0.dev175337561}/braindecode/modules/parametrization.py +0 -0
- {braindecode-1.2.0.dev175267687 → braindecode-1.2.0.dev175337561}/braindecode/modules/stats.py +0 -0
- {braindecode-1.2.0.dev175267687 → braindecode-1.2.0.dev175337561}/braindecode/modules/util.py +0 -0
- {braindecode-1.2.0.dev175267687 → braindecode-1.2.0.dev175337561}/braindecode/modules/wrapper.py +0 -0
- {braindecode-1.2.0.dev175267687 → braindecode-1.2.0.dev175337561}/braindecode/preprocessing/__init__.py +0 -0
- {braindecode-1.2.0.dev175267687 → braindecode-1.2.0.dev175337561}/braindecode/preprocessing/mne_preprocess.py +0 -0
- {braindecode-1.2.0.dev175267687 → braindecode-1.2.0.dev175337561}/braindecode/preprocessing/preprocess.py +0 -0
- {braindecode-1.2.0.dev175267687 → braindecode-1.2.0.dev175337561}/braindecode/preprocessing/windowers.py +0 -0
- {braindecode-1.2.0.dev175267687 → braindecode-1.2.0.dev175337561}/braindecode/regressor.py +0 -0
- {braindecode-1.2.0.dev175267687 → braindecode-1.2.0.dev175337561}/braindecode/samplers/__init__.py +0 -0
- {braindecode-1.2.0.dev175267687 → braindecode-1.2.0.dev175337561}/braindecode/samplers/base.py +0 -0
- {braindecode-1.2.0.dev175267687 → braindecode-1.2.0.dev175337561}/braindecode/samplers/ssl.py +0 -0
- {braindecode-1.2.0.dev175267687 → braindecode-1.2.0.dev175337561}/braindecode/training/__init__.py +0 -0
- {braindecode-1.2.0.dev175267687 → braindecode-1.2.0.dev175337561}/braindecode/training/callbacks.py +0 -0
- {braindecode-1.2.0.dev175267687 → braindecode-1.2.0.dev175337561}/braindecode/training/losses.py +0 -0
- {braindecode-1.2.0.dev175267687 → braindecode-1.2.0.dev175337561}/braindecode/training/scoring.py +0 -0
- {braindecode-1.2.0.dev175267687 → braindecode-1.2.0.dev175337561}/braindecode/util.py +0 -0
- {braindecode-1.2.0.dev175267687 → braindecode-1.2.0.dev175337561}/braindecode/visualization/__init__.py +0 -0
- {braindecode-1.2.0.dev175267687 → braindecode-1.2.0.dev175337561}/braindecode/visualization/confusion_matrices.py +0 -0
- {braindecode-1.2.0.dev175267687 → braindecode-1.2.0.dev175337561}/braindecode/visualization/gradients.py +0 -0
- {braindecode-1.2.0.dev175267687 → braindecode-1.2.0.dev175337561}/braindecode.egg-info/dependency_links.txt +0 -0
- {braindecode-1.2.0.dev175267687 → braindecode-1.2.0.dev175337561}/braindecode.egg-info/top_level.txt +0 -0
- {braindecode-1.2.0.dev175267687 → braindecode-1.2.0.dev175337561}/docs/Makefile +0 -0
- {braindecode-1.2.0.dev175267687 → braindecode-1.2.0.dev175337561}/docs/_templates/autosummary/class.rst +0 -0
- {braindecode-1.2.0.dev175267687 → braindecode-1.2.0.dev175337561}/docs/_templates/autosummary/function.rst +0 -0
- {braindecode-1.2.0.dev175267687 → braindecode-1.2.0.dev175337561}/docs/cite.rst +0 -0
- {braindecode-1.2.0.dev175267687 → braindecode-1.2.0.dev175337561}/docs/help.rst +0 -0
- {braindecode-1.2.0.dev175267687 → braindecode-1.2.0.dev175337561}/docs/install/install.rst +0 -0
- {braindecode-1.2.0.dev175267687 → braindecode-1.2.0.dev175337561}/docs/install/install_pip.rst +0 -0
- {braindecode-1.2.0.dev175267687 → braindecode-1.2.0.dev175337561}/docs/install/install_source.rst +0 -0
- {braindecode-1.2.0.dev175267687 → braindecode-1.2.0.dev175337561}/setup.cfg +0 -0
{braindecode-1.2.0.dev175267687/braindecode.egg-info → braindecode-1.2.0.dev175337561}/PKG-INFO
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: braindecode
|
|
3
|
-
Version: 1.2.0.
|
|
3
|
+
Version: 1.2.0.dev175337561
|
|
4
4
|
Summary: Deep learning software to decode EEG, ECG or MEG signals
|
|
5
5
|
Author-email: Robin Tibor Schirrmeister <robintibor@gmail.com>
|
|
6
6
|
Maintainer-email: Alexandre Gramfort <agramfort@meta.com>, Bruno Aristimunha Pinto <b.aristimunha@gmail.com>, Robin Tibor Schirrmeister <robintibor@gmail.com>
|
|
@@ -17,7 +17,7 @@ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
|
17
17
|
Classifier: Programming Language :: Python :: 3.10
|
|
18
18
|
Classifier: Programming Language :: Python :: 3.11
|
|
19
19
|
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
-
Requires-Python:
|
|
20
|
+
Requires-Python: >3.10
|
|
21
21
|
Description-Content-Type: text/x-rst
|
|
22
22
|
License-File: LICENSE.txt
|
|
23
23
|
License-File: NOTICE.txt
|
|
@@ -49,10 +49,6 @@ Requires-Dist: mypy; extra == "tests"
|
|
|
49
49
|
Provides-Extra: docs
|
|
50
50
|
Requires-Dist: sphinx_gallery; extra == "docs"
|
|
51
51
|
Requires-Dist: sphinx_rtd_theme; extra == "docs"
|
|
52
|
-
Requires-Dist: sphinx-autodoc-typehints; extra == "docs"
|
|
53
|
-
Requires-Dist: sphinx-autobuild; extra == "docs"
|
|
54
|
-
Requires-Dist: sphinxcontrib-bibtex; extra == "docs"
|
|
55
|
-
Requires-Dist: sphinx_sitemap; extra == "docs"
|
|
56
52
|
Requires-Dist: pydata_sphinx_theme; extra == "docs"
|
|
57
53
|
Requires-Dist: numpydoc; extra == "docs"
|
|
58
54
|
Requires-Dist: memory_profiler; extra == "docs"
|
|
@@ -63,7 +59,6 @@ Requires-Dist: lightning; extra == "docs"
|
|
|
63
59
|
Requires-Dist: seaborn; extra == "docs"
|
|
64
60
|
Requires-Dist: pre-commit; extra == "docs"
|
|
65
61
|
Requires-Dist: openneuro-py; extra == "docs"
|
|
66
|
-
Requires-Dist: plotly; extra == "docs"
|
|
67
62
|
Provides-Extra: all
|
|
68
63
|
Requires-Dist: braindecode[docs,moabb,tests]; extra == "all"
|
|
69
64
|
Dynamic: license-file
|
{braindecode-1.2.0.dev175267687 → braindecode-1.2.0.dev175337561}/braindecode/models/__init__.py
RENAMED
|
@@ -4,7 +4,6 @@ Some predefined network architectures for EEG decoding.
|
|
|
4
4
|
|
|
5
5
|
from .atcnet import ATCNet
|
|
6
6
|
from .attentionbasenet import AttentionBaseNet
|
|
7
|
-
from .attn_sleep import AttnSleep
|
|
8
7
|
from .base import EEGModuleMixin
|
|
9
8
|
from .biot import BIOT
|
|
10
9
|
from .contrawr import ContraWR
|
|
@@ -16,8 +15,9 @@ from .eeginception_erp import EEGInceptionERP
|
|
|
16
15
|
from .eeginception_mi import EEGInceptionMI
|
|
17
16
|
from .eegitnet import EEGITNet
|
|
18
17
|
from .eegminer import EEGMiner
|
|
19
|
-
from .eegnet import
|
|
18
|
+
from .eegnet import EEGNetv1, EEGNetv4
|
|
20
19
|
from .eegnex import EEGNeX
|
|
20
|
+
from .eegresnet import EEGResNet
|
|
21
21
|
from .eegsimpleconv import EEGSimpleConv
|
|
22
22
|
from .eegtcnet import EEGTCNet
|
|
23
23
|
from .fbcnet import FBCNet
|
|
@@ -38,11 +38,12 @@ from .signal_jepa import (
|
|
|
38
38
|
from .sinc_shallow import SincShallowNet
|
|
39
39
|
from .sleep_stager_blanco_2020 import SleepStagerBlanco2020
|
|
40
40
|
from .sleep_stager_chambon_2018 import SleepStagerChambon2018
|
|
41
|
+
from .sleep_stager_eldele_2021 import SleepStagerEldele2021
|
|
41
42
|
from .sparcnet import SPARCNet
|
|
42
43
|
from .syncnet import SyncNet
|
|
43
44
|
from .tcn import BDTCN, TCN
|
|
44
45
|
from .tidnet import TIDNet
|
|
45
|
-
from .tsinception import
|
|
46
|
+
from .tsinception import TSceptionV1
|
|
46
47
|
from .usleep import USleep
|
|
47
48
|
from .util import _init_models_dict, models_mandatory_parameters
|
|
48
49
|
|
|
@@ -52,7 +53,6 @@ _init_models_dict()
|
|
|
52
53
|
|
|
53
54
|
__all__ = [
|
|
54
55
|
"ATCNet",
|
|
55
|
-
"AttnSleep",
|
|
56
56
|
"AttentionBaseNet",
|
|
57
57
|
"EEGModuleMixin",
|
|
58
58
|
"BIOT",
|
|
@@ -65,9 +65,10 @@ __all__ = [
|
|
|
65
65
|
"EEGInceptionMI",
|
|
66
66
|
"EEGITNet",
|
|
67
67
|
"EEGMiner",
|
|
68
|
-
"
|
|
68
|
+
"EEGNetv1",
|
|
69
69
|
"EEGNetv4",
|
|
70
70
|
"EEGNeX",
|
|
71
|
+
"EEGResNet",
|
|
71
72
|
"EEGSimpleConv",
|
|
72
73
|
"EEGTCNet",
|
|
73
74
|
"FBCNet",
|
|
@@ -86,12 +87,13 @@ __all__ = [
|
|
|
86
87
|
"SincShallowNet",
|
|
87
88
|
"SleepStagerBlanco2020",
|
|
88
89
|
"SleepStagerChambon2018",
|
|
90
|
+
"SleepStagerEldele2021",
|
|
89
91
|
"SPARCNet",
|
|
90
92
|
"SyncNet",
|
|
91
93
|
"BDTCN",
|
|
92
94
|
"TCN",
|
|
93
95
|
"TIDNet",
|
|
94
|
-
"
|
|
96
|
+
"TSceptionV1",
|
|
95
97
|
"USleep",
|
|
96
98
|
"_init_models_dict",
|
|
97
99
|
"models_mandatory_parameters",
|
{braindecode-1.2.0.dev175267687 → braindecode-1.2.0.dev175337561}/braindecode/models/atcnet.py
RENAMED
|
@@ -138,7 +138,7 @@ class ATCNet(EEGModuleMixin, nn.Module):
|
|
|
138
138
|
.. rubric:: Usage and Configuration
|
|
139
139
|
|
|
140
140
|
- ``conv_block_n_filters (F1)``, ``conv_block_depth_mult (D)`` → capacity of the stem
|
|
141
|
-
(with ``F2 = F1·D`` feeding attention/TCN), dimensions aligned to ``F2``, like
|
|
141
|
+
(with ``F2 = F1·D`` feeding attention/TCN), dimensions aligned to ``F2``, like `EEGNetv4`.
|
|
142
142
|
- Pool sizes ``P1,P2`` trade temporal resolution for stability/compute; they set
|
|
143
143
|
``T_c = T/(P1·P2)`` and thus window width ``T_w``.
|
|
144
144
|
- ``n_windows`` controls the ensemble over shifts (compute ∝ windows).
|
|
@@ -24,7 +24,7 @@ from braindecode.modules.attention import (
|
|
|
24
24
|
|
|
25
25
|
|
|
26
26
|
class AttentionBaseNet(EEGModuleMixin, nn.Module):
|
|
27
|
-
"""
|
|
27
|
+
"""
|
|
28
28
|
|
|
29
29
|
:bdg-success:`Convolution` :bdg-info:`Small Attention`
|
|
30
30
|
|
|
@@ -57,9 +57,9 @@ class AttentionBaseNet(EEGModuleMixin, nn.Module):
|
|
|
57
57
|
|
|
58
58
|
- *Operations.*
|
|
59
59
|
- **Temporal conv** (:class:`torch.nn.Conv2d`) with kernel ``(1, L_t)`` creates a learned
|
|
60
|
-
|
|
60
|
+
FIR-like filter bank with ``n_temporal_filters`` maps.
|
|
61
61
|
- **Depthwise spatial conv** (:class:`torch.nn.Conv2d`, ``groups=n_temporal_filters``)
|
|
62
|
-
|
|
62
|
+
with kernel ``(n_chans, 1)`` learns per-filter spatial projections over the full montage.
|
|
63
63
|
- **BatchNorm → ELU → AvgPool → Dropout** stabilize and downsample time.
|
|
64
64
|
- Output shape: ``(B, F2, 1, T₁)`` with ``F2 = n_temporal_filters x spatial_expansion``.
|
|
65
65
|
|
|
@@ -71,8 +71,8 @@ class AttentionBaseNet(EEGModuleMixin, nn.Module):
|
|
|
71
71
|
|
|
72
72
|
- *Operations.*
|
|
73
73
|
- A ``1x1`` conv → BN → activation maps ``F2 → ch_dim`` without changing
|
|
74
|
-
|
|
75
|
-
|
|
74
|
+
the temporal length ``T₁`` (shape: ``(B, ch_dim, 1, T₁)``).
|
|
75
|
+
This sets the embedding width for the attention block.
|
|
76
76
|
|
|
77
77
|
- :class:`_ChannelAttentionBlock` **(temporal refinement + channel attention)**
|
|
78
78
|
|
|
@@ -117,10 +117,8 @@ class AttentionBaseNet(EEGModuleMixin, nn.Module):
|
|
|
117
117
|
- **Type.** Channel attention chosen by ``attention_mode`` (SE, ECA, CBAM, CAT, GSoP,
|
|
118
118
|
EncNet, GE, GCT, SRM, CATLite). Most operate purely on channels; CBAM/CAT additionally
|
|
119
119
|
include temporal attention.
|
|
120
|
-
|
|
121
120
|
- **Shapes.** Input/Output around attention: ``(B, ch_dim, 1, T₁)``. Re-arrangements
|
|
122
121
|
(if any) are internal to the module; the block returns the same shape before pooling.
|
|
123
|
-
|
|
124
122
|
- **Role.** Re-weights channels (and optionally time) to highlight informative sources
|
|
125
123
|
and suppress distractors, improving SNR ahead of the linear head.
|
|
126
124
|
|
|
@@ -165,11 +163,10 @@ class AttentionBaseNet(EEGModuleMixin, nn.Module):
|
|
|
165
163
|
Notes
|
|
166
164
|
-----
|
|
167
165
|
- Sequence length after each stage is computed internally; the final classifier expects
|
|
168
|
-
|
|
166
|
+
a flattened ``ch_dim x T₂`` vector.
|
|
169
167
|
- Attention operates on *channel* dimension by design; temporal gating exists only in
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
choices are available at the [Martin2023]_ and [MartinCode]_.
|
|
168
|
+
specific variants (CBAM/CAT).
|
|
169
|
+
|
|
173
170
|
.. versionadded:: 0.9
|
|
174
171
|
|
|
175
172
|
Parameters
|
|
@@ -198,18 +195,18 @@ class AttentionBaseNet(EEGModuleMixin, nn.Module):
|
|
|
198
195
|
the depth of the network after the initial layer. Default is 16.
|
|
199
196
|
attention_mode : str, optional
|
|
200
197
|
The type of attention mechanism to apply. If `None`, no attention is applied.
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
198
|
+
- "se" for Squeeze-and-excitation network
|
|
199
|
+
- "gsop" for Global Second-Order Pooling
|
|
200
|
+
- "fca" for Frequency Channel Attention Network
|
|
201
|
+
- "encnet" for context encoding module
|
|
202
|
+
- "eca" for Efficient channel attention for deep convolutional neural networks
|
|
203
|
+
- "ge" for Gather-Excite
|
|
204
|
+
- "gct" for Gated Channel Transformation
|
|
205
|
+
- "srm" for Style-based Recalibration Module
|
|
206
|
+
- "cbam" for Convolutional Block Attention Module
|
|
207
|
+
- "cat" for Learning to collaborate channel and temporal attention
|
|
208
|
+
from multi-information fusion
|
|
209
|
+
- "catlite" for Learning to collaborate channel attention
|
|
213
210
|
from multi-information fusion (lite version, cat w/o temporal attention)
|
|
214
211
|
pool_length : int, default=8
|
|
215
212
|
The length of the window for the average pooling operation.
|
{braindecode-1.2.0.dev175267687 → braindecode-1.2.0.dev175337561}/braindecode/models/ctnet.py
RENAMED
|
@@ -39,7 +39,7 @@ class CTNet(EEGModuleMixin, nn.Module):
|
|
|
39
39
|
The architecture consists of three main components:
|
|
40
40
|
|
|
41
41
|
1. **Convolutional Module**:
|
|
42
|
-
- Apply
|
|
42
|
+
- Apply EEGNetV4 to perform some feature extraction, denoted here as
|
|
43
43
|
_PatchEmbeddingEEGNet module.
|
|
44
44
|
|
|
45
45
|
2. **Transformer Encoder Module**:
|
{braindecode-1.2.0.dev175267687 → braindecode-1.2.0.dev175337561}/braindecode/models/deep4.py
RENAMED
|
@@ -19,13 +19,9 @@ from braindecode.modules import (
|
|
|
19
19
|
class Deep4Net(EEGModuleMixin, nn.Sequential):
|
|
20
20
|
"""Deep ConvNet model from Schirrmeister et al (2017) [Schirrmeister2017]_.
|
|
21
21
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
.. figure:: https://onlinelibrary.wiley.com/cms/asset/fc200ccc-d8c4-45b4-8577-56ce4d15999a/hbm23730-fig-0001-m.jpg
|
|
22
|
+
.. figure:: https://onlinelibrary.wiley.com/cms/asset/fc200ccc-d8c4-45b4-8577-56ce4d15999a/hbm23730-fig-0001-m.jpg
|
|
25
23
|
:align: center
|
|
26
|
-
:alt:
|
|
27
|
-
:width: 600px
|
|
28
|
-
|
|
24
|
+
:alt: CTNet Architecture
|
|
29
25
|
|
|
30
26
|
Model described in [Schirrmeister2017]_.
|
|
31
27
|
|
{braindecode-1.2.0.dev175267687 → braindecode-1.2.0.dev175337561}/braindecode/models/deepsleepnet.py
RENAMED
|
@@ -8,128 +8,14 @@ from braindecode.models.base import EEGModuleMixin
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
class DeepSleepNet(EEGModuleMixin, nn.Module):
|
|
11
|
-
"""
|
|
11
|
+
"""Sleep staging architecture from Supratak et al. (2017) [Supratak2017]_.
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
.. figure:: https://raw.githubusercontent.com/akaraspt/deepsleepnet/master/img/deepsleepnet.png
|
|
13
|
+
.. figure:: https://raw.githubusercontent.com/akaraspt/deepsleepnet/refs/heads/master/img/deepsleepnet.png
|
|
16
14
|
:align: center
|
|
17
15
|
:alt: DeepSleepNet Architecture
|
|
18
|
-
:width: 700px
|
|
19
|
-
|
|
20
|
-
.. rubric:: Architectural Overview
|
|
21
|
-
|
|
22
|
-
DeepSleepNet couples **dual-path convolution neural network representation learning** with
|
|
23
|
-
**sequence residual learning** via bidirectional LSTMs.
|
|
24
|
-
|
|
25
|
-
The network have:
|
|
26
|
-
|
|
27
|
-
- (i) learns complementary, time-frequency features from each
|
|
28
|
-
30-s epoch using **two parallel CNNs** (small vs. large first-layer filters), then
|
|
29
|
-
- (ii) models **temporal dependencies across epochs** using **two-layer BiLSTMs**
|
|
30
|
-
with a **residual shortcut** from the CNN features, and finally
|
|
31
|
-
- (iii) outputs per-epoch sleep stages. This design encodes both
|
|
32
|
-
epoch-local patterns and longer-range transition rules used by human scorers.
|
|
33
|
-
|
|
34
|
-
In term of implementation:
|
|
35
|
-
|
|
36
|
-
- (i) :class:`_RepresentationLearning` two CNNs extract epoch-wise features
|
|
37
|
-
(small-filter path for temporal precision; large-filter path for frequency precision);
|
|
38
|
-
- (ii) :class:`_SequenceResidualLearning` stacked BiLSTMs with peepholes + residual shortcut
|
|
39
|
-
inject temporal context while preserving CNN evidence;
|
|
40
|
-
- (iii) :class:`_Classifier` linear readout (softmax) for the five sleep stages.
|
|
41
|
-
|
|
42
|
-
.. rubric:: Macro Components
|
|
43
|
-
|
|
44
|
-
- :class:`_RepresentationLearning` **(dual-path CNN → epoch feature)**
|
|
45
|
-
|
|
46
|
-
- *Operations.*
|
|
47
|
-
- **Small-filter CNN** 4 times:
|
|
48
|
-
- :class:`~torch.nn.Conv1d`
|
|
49
|
-
- :class:`~torch.nn.BatchNorm1d`
|
|
50
|
-
- :class:`~torch.nn.ReLU`
|
|
51
|
-
- :class:`~torch.nn.MaxPool1d` after.
|
|
52
|
-
First conv uses **filter length ≈ Fs/2** and **stride ≈ Fs/16** to emphasize *timing* of graphoelements.
|
|
53
|
-
- **Large-filter CNN**:
|
|
54
|
-
- Same stack but first conv uses **filter length ≈ 4·Fs** and
|
|
55
|
-
- **stride ≈ Fs/2** to emphasize *frequency* content.
|
|
56
|
-
- Outputs from both paths are **concatenated** into the epoch embedding ``a_t``.
|
|
57
|
-
|
|
58
|
-
- *Rationale.*
|
|
59
|
-
Two first-layer scales provide a **learned, dual-scale filter bank** that trades
|
|
60
|
-
temporal vs. frequency precision without hand-crafted features.
|
|
61
|
-
|
|
62
|
-
- :class:`_SequenceResidualLearning` (:class:`~torch.nn.BiLSTM` **context + residual fusion)**
|
|
63
|
-
|
|
64
|
-
- *Operations.*
|
|
65
|
-
- **Two-layer BiLSTM** with **peephole connections** processes the sequence of epoch embeddings
|
|
66
|
-
``{a_t}`` forward and backward; hidden states from both directions are **concatenated**.
|
|
67
|
-
- A **shortcut MLP** (fully connected + :class:`~torch.nn.BatchNorm1d` + :class:`~torch.nn.ReLU`) projects ``a_t`` to the BiLSTM output
|
|
68
|
-
dimension and is **added** (residual) to the :class:`~torch.nn.BiLSTM` output at each time step.
|
|
69
|
-
- *Role.* Encodes **stage-transition rules** and smooths predictions over time while preserving
|
|
70
|
-
salient CNN features via the residual path.
|
|
71
|
-
|
|
72
|
-
- :class:`_Classifier` **(epoch-wise prediction)**
|
|
73
|
-
|
|
74
|
-
- *Operations.*
|
|
75
|
-
- :class:`~torch.nn.Linear` to produce per-epoch class probabilities.
|
|
76
16
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
.. rubric:: Convolutional Details
|
|
81
|
-
|
|
82
|
-
- **Temporal (where time-domain patterns are learned).**
|
|
83
|
-
|
|
84
|
-
Both CNN paths use **1-D temporal convolutions**. The *small-filter* path (first kernel ≈ Fs/2,
|
|
85
|
-
stride ≈ Fs/16) captures *when* characteristic transients occur; the *large-filter* path
|
|
86
|
-
(first kernel ≈ 4·Fs, stride ≈ Fs/2) captures *which* frequency components dominate over the
|
|
87
|
-
epoch. Deeper layers use **small kernels** to refine features with fewer parameters, interleaved
|
|
88
|
-
with **max pooling** for downsampling.
|
|
89
|
-
|
|
90
|
-
- **Spatial (how channels are processed).**
|
|
91
|
-
The original model operates on **single-channel** raw EEG; convolutions therefore mix only
|
|
92
|
-
along time (no spatial convolution across electrodes).
|
|
93
|
-
|
|
94
|
-
- **Spectral (how frequency information emerges).**
|
|
95
|
-
No explicit Fourier/wavelet transform is used. The **large-filter path** serves as a
|
|
96
|
-
*frequency-sensitive* analyzer, while the **small-filter path** remains *time-sensitive*,
|
|
97
|
-
together functioning as a **two-band learned filter bank** at the first layer.
|
|
98
|
-
|
|
99
|
-
.. rubric:: Attention / Sequential Modules
|
|
100
|
-
|
|
101
|
-
- **Type.** **Bidirectional LSTM** (two layers) with **peephole connections**; forward and
|
|
102
|
-
backward streams are independent and concatenated.
|
|
103
|
-
- **Shapes.** For a sequence of ``N`` epochs, the CNN produces ``{a_t} ∈ R^{D}``;
|
|
104
|
-
BiLSTM outputs ``h_t ∈ R^{2H}``; the shortcut MLP maps ``a_t → R^{2H}`` to enable
|
|
105
|
-
**element-wise residual addition**.
|
|
106
|
-
- **Role.** Models **long-range temporal dependencies** (e.g., persisting N2 without visible
|
|
107
|
-
K-complex/spindles), stabilizing per-epoch predictions.
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
.. rubric:: Additional Mechanisms
|
|
111
|
-
|
|
112
|
-
- **Residual shortcut over sequence encoder.** Adds projected CNN features to BiLSTM outputs,
|
|
113
|
-
improving gradient flow and retaining discriminative content from representation learning.
|
|
114
|
-
- **Two-step training.**
|
|
115
|
-
- (i) **Pretrain** the CNN paths with class-balanced sampling;
|
|
116
|
-
- (ii) **fine-tune** the full network with sequential batches, using **lower LR** for CNNs and **higher LR** for the
|
|
117
|
-
sequence encoder.
|
|
118
|
-
- **State handling.** BiLSTM states are **reinitialized per subject** so that temporal context
|
|
119
|
-
does not leak across recordings.
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
.. rubric:: Usage and Configuration
|
|
123
|
-
|
|
124
|
-
- **Epoch pipeline.** Use **two parallel CNNs** with the first conv sized to **Fs/2** (small path)
|
|
125
|
-
and **4·Fs** (large path), with strides **Fs/16** and **Fs/2**, respectively; stack three more
|
|
126
|
-
conv blocks with small kernels, plus **max pooling** in each path. Concatenate path outputs
|
|
127
|
-
to form epoch embeddings.
|
|
128
|
-
- **Sequence encoder.** Apply **two-layer BiLSTM (peepholes)** over the sequence of embeddings;
|
|
129
|
-
add a **projection MLP** on the CNN features and **sum** with BiLSTM outputs (residual).
|
|
130
|
-
Finish with :class:`~torch.nn.Linear` per epoch.
|
|
131
|
-
- **Reference implementation.** See the official repository for a faithful implementation and
|
|
132
|
-
training scripts.
|
|
17
|
+
Convolutional neural network and bidirectional-Long Short-Term
|
|
18
|
+
for single channels sleep staging described in [Supratak2017]_.
|
|
133
19
|
|
|
134
20
|
Parameters
|
|
135
21
|
----------
|
|
@@ -146,6 +32,7 @@ class DeepSleepNet(EEGModuleMixin, nn.Module):
|
|
|
146
32
|
drop_prob : float, default=0.5
|
|
147
33
|
The dropout rate for regularization. Values should be between 0 and 1.
|
|
148
34
|
|
|
35
|
+
|
|
149
36
|
References
|
|
150
37
|
----------
|
|
151
38
|
.. [Supratak2017] Supratak, A., Dong, H., Wu, C., & Guo, Y. (2017).
|
{braindecode-1.2.0.dev175267687 → braindecode-1.2.0.dev175337561}/braindecode/models/eegconformer.py
RENAMED
|
@@ -27,25 +27,22 @@ class EEGConformer(EEGModuleMixin, nn.Module):
|
|
|
27
27
|
EEG-Conformer is a *convolution-first* model augmented with a *lightweight transformer
|
|
28
28
|
encoder*. The end-to-end flow is:
|
|
29
29
|
|
|
30
|
-
- (i) :class:`_PatchEmbedding` converts the continuous EEG into a compact sequence of tokens via a
|
|
31
|
-
|
|
32
|
-
- (ii) :class:`_TransformerEncoder` applies small multi-head self-attention to integrate
|
|
33
|
-
longer-range temporal context across tokens;
|
|
30
|
+
- (i) :class:`_PatchEmbedding` converts the continuous EEG into a compact sequence of tokens via a :class:`ShallowFBCSPNet` temporal–spatial conv stem and temporal pooling;
|
|
31
|
+
- (ii) :class:`_TransformerEncoder applies small multi-head self-attention to integrate longer-range temporal context across tokens;
|
|
34
32
|
- (iii) :class:`_ClassificationHead` aggregates the sequence and performs a linear readout.
|
|
35
|
-
|
|
36
|
-
|
|
33
|
+
This preserves the strong inductive biases of shallow CNN filter banks while adding
|
|
34
|
+
just enough attention to capture dependencies beyond the pooling horizon [song2022]_.
|
|
37
35
|
|
|
38
36
|
.. rubric:: Macro Components
|
|
39
37
|
|
|
40
38
|
- :class:`_PatchEmbedding` **(Shallow conv stem → tokens)**
|
|
41
39
|
|
|
42
|
-
|
|
43
|
-
- A temporal convolution (`:class
|
|
44
|
-
- A spatial convolution (`:class
|
|
45
|
-
|
|
46
|
-
- **
|
|
47
|
-
- **
|
|
48
|
-
- **Average Pooling** :class:`torch.nn.AvgPool` along time (kernel ``(1, P)`` with stride ``(1, S)``)
|
|
40
|
+
- *Operations.*
|
|
41
|
+
- A temporal convolution (`:class:`torch.nn.Conv2d`) ``(1 x L_t)`` forms a data-driven "filter bank";
|
|
42
|
+
- A spatial convolution (`:class:`torch.nn.Conv2d`) (n_chans x 1)`` projects across electrodes, collapsing the channel axis into a virtual channel.
|
|
43
|
+
- **Normalization function** `:class:torch.nn.BatchNorm`
|
|
44
|
+
- **Activation function** `:class:torch.nn.ELU`
|
|
45
|
+
- **Average Pooling** `:class:torch.nn.AvgPool` along time (kernel ``(1, P)`` with stride ``(1, S)``)
|
|
49
46
|
- final ``1x1`` :class:`torch.nn.Linear` projection.
|
|
50
47
|
|
|
51
48
|
The result is rearranged to a token sequence ``(B, S_tokens, D)``, where ``D = n_filters_time``.
|
|
@@ -56,7 +53,7 @@ class EEGConformer(EEGModuleMixin, nn.Module):
|
|
|
56
53
|
|
|
57
54
|
- :class:`_TransformerEncoder` **(context over temporal tokens)**
|
|
58
55
|
|
|
59
|
-
|
|
56
|
+
- *Operations.*
|
|
60
57
|
- A stack of ``att_depth`` encoder blocks. :class:`_TransformerEncoderBlock`
|
|
61
58
|
- Each block applies LayerNorm :class:`torch.nn.LayerNorm`
|
|
62
59
|
- Multi-Head Self-Attention (``att_heads``) with dropout + residual :class:`MultiHeadAttention` (:class:`torch.nn.Dropout`)
|
|
@@ -70,7 +67,7 @@ class EEGConformer(EEGModuleMixin, nn.Module):
|
|
|
70
67
|
|
|
71
68
|
- :class:`ClassificationHead` **(aggregation + readout)**
|
|
72
69
|
|
|
73
|
-
|
|
70
|
+
- *Operations*.
|
|
74
71
|
- Flatten, :class:`torch.nn.Flatten` the sequence ``(B, S_tokens·D)`` -
|
|
75
72
|
- MLP (:class:`torch.nn.Linear` → activation (default: :class:`torch.nn.ELU`) → :class:`torch.nn.Dropout` → :class:`torch.nn.Linear`)
|
|
76
73
|
- final Linear to classes.
|
|
@@ -15,84 +15,12 @@ from braindecode.modules import DepthwiseConv2d, Ensure4d, InceptionBlock
|
|
|
15
15
|
class EEGInceptionERP(EEGModuleMixin, nn.Sequential):
|
|
16
16
|
"""EEG Inception for ERP-based from Santamaria-Vazquez et al (2020) [santamaria2020]_.
|
|
17
17
|
|
|
18
|
-
:bdg-success:`Convolution`
|
|
19
|
-
|
|
20
18
|
.. figure:: https://braindecode.org/dev/_static/model/eeginceptionerp.jpg
|
|
21
19
|
:align: center
|
|
22
20
|
:alt: EEGInceptionERP Architecture
|
|
23
21
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
.. rubric:: Architectural Overview
|
|
27
|
-
|
|
28
|
-
A two-stage, multi-scale CNN tailored to ERP detection from short (0-1000 ms) single-trial epochs. Signals are mapped through
|
|
29
|
-
* (i) :class:`_InceptionModule1` multi-scale temporal feature extraction plus per-branch spatial mixing;
|
|
30
|
-
* (ii) :class:`_InceptionModule2` deeper multi-scale refinement at a reduced temporal resolution; and
|
|
31
|
-
* (iii) :class:`_OutputModule` compact aggregation and linear readout.
|
|
32
|
-
|
|
33
|
-
.. rubric:: Macro Components
|
|
34
|
-
|
|
35
|
-
- :class:`_InceptionModule1` **(multi-scale temporal + spatial mixing)**
|
|
36
|
-
|
|
37
|
-
- *Operations.*
|
|
38
|
-
- `EEGInceptionERP.c1`: :class:`torch.nn.Conv2d` ``k=(64,1)``, stride ``(1,1)``, *same* pad on input reshaped to ``(B,1,128,8)`` → BN → activation → dropout.
|
|
39
|
-
- `EEGInceptionERP.d1`: :class:`torch.nn.Conv2d` (depthwise) ``k=(1,8)``, *valid* pad over channels → BN → activation → dropout.
|
|
40
|
-
- `EEGInceptionERP.c2`: :class:`torch.nn.Conv2d` ``k=(32,1)`` → BN → activation → dropout; then `EEGInceptionERP.d2` depthwise ``k=(1,8)`` → BN → activation → dropout.
|
|
41
|
-
- `EEGInceptionERP.c3`: :class:`torch.nn.Conv2d` ``k=(16,1)`` → BN → activation → dropout; then `EEGInceptionERP.d3` depthwise ``k=(1,8)`` → BN → activation → dropout.
|
|
42
|
-
- `EEGInceptionERP.n1`: :class:`torch.nn.Concat` over branch features.
|
|
43
|
-
- `EEGInceptionERP.a1`: :class:`torch.nn.AvgPool2d` ``pool=(4,1)``, stride ``(4,1)`` for temporal downsampling.
|
|
44
|
-
|
|
45
|
-
*Interpretability/robustness.* Depthwise `1 x n_chans` layers act as learnable montage-wide spatial filters per temporal scale; pooling stabilizes against jitter.
|
|
46
|
-
|
|
47
|
-
- :class:`_InceptionModule2` **(refinement at coarser timebase)**
|
|
48
|
-
|
|
49
|
-
- *Operations.*
|
|
50
|
-
- `EEGInceptionERP.c4`: :class:`torch.nn.Conv2d` ``k=(16,1)`` → BN → activation → dropout.
|
|
51
|
-
- `EEGInceptionERP.c5`: :class:`torch.nn.Conv2d` ``k=(8,1)`` → BN → activation → dropout.
|
|
52
|
-
- `EEGInceptionERP.c6`: :class:`torch.nn.Conv2d` ``k=(4,1)`` → BN → activation → dropout.
|
|
53
|
-
- `EEGInceptionERP.n2`: :class:`torch.nn.Concat` (merge C4-C6 outputs).
|
|
54
|
-
- `EEGInceptionERP.a2`: :class:`torch.nn.AvgPool2d` ``pool=(2,1)``, stride ``(2,1)``.
|
|
55
|
-
- `EEGInceptionERP.c7`: :class:`torch.nn.Conv2d` ``k=(8,1)`` → BN → activation → dropout; then `EEGInceptionERP.a3`: :class:`torch.nn.AvgPool2d` ``pool=(2,1)``.
|
|
56
|
-
- `EEGInceptionERP.c8`: :class:`torch.nn.Conv2d` ``k=(4,1)`` → BN → activation → dropout; then `EEGInceptionERP.a4`: :class:`torch.nn.AvgPool2d` ``pool=(2,1)``.
|
|
57
|
-
|
|
58
|
-
*Role.* Adds higher-level, shorter-window evidence while progressively compressing temporal dimension.
|
|
59
|
-
|
|
60
|
-
- :class:`_OutputModule` **(aggregation + readout)**
|
|
61
|
-
|
|
62
|
-
- *Operations.*
|
|
63
|
-
- :class:`torch.nn.Flatten`
|
|
64
|
-
- :class:`torch.nn.Linear` ``(features → 2)``
|
|
65
|
-
|
|
66
|
-
.. rubric:: Convolutional Details
|
|
67
|
-
|
|
68
|
-
- **Temporal (where time-domain patterns are learned).**
|
|
69
|
-
First module uses 1D temporal kernels along the 128-sample axis: ``64``, ``32``, ``16``
|
|
70
|
-
(≈500, 250, 125 ms at 128 Hz). After ``pool=(4,1)``, the second module applies ``16``,
|
|
71
|
-
``8``, ``4`` (≈125, 62.5, 31.25 ms at the pooled rate). All strides are ``1`` in convs;
|
|
72
|
-
temporal resolution changes only via average pooling.
|
|
73
|
-
|
|
74
|
-
- **Spatial (how electrodes are processed).**
|
|
75
|
-
Depthwise convs with ``k=(1,8)`` span all channels and are applied **per temporal branch**,
|
|
76
|
-
yielding scale-specific channel projections (no cross-branch mixing until concatenation).
|
|
77
|
-
There is no full 2D mixing kernel; spatial mixing is factorized and lightweight.
|
|
78
|
-
|
|
79
|
-
- **Spectral (how frequency information is captured).**
|
|
80
|
-
No explicit transform; multiple temporal kernels form a *learned filter bank* over
|
|
81
|
-
ERP-relevant bands. Successive pooling acts as low-pass integration to emphasize sustained
|
|
82
|
-
post-stimulus components.
|
|
83
|
-
|
|
84
|
-
.. rubric:: Additional Mechanisms
|
|
85
|
-
|
|
86
|
-
- Every conv/depthwise block includes **BatchNorm**, nonlinearity (paper used grid-searched activation), and **dropout**.
|
|
87
|
-
- Two Inception stages followed by short convs and pooling keep parameters small (≈15k reported) while preserving multi-scale evidence.
|
|
88
|
-
- Expected input: epochs of shape ``(B,1,128,8)`` (time x channels as a 2D map) or reshaped from ``(B,8,128)`` with an added singleton feature dimension.
|
|
89
|
-
|
|
90
|
-
.. rubric:: Usage and Configuration
|
|
91
|
-
|
|
92
|
-
- **Key knobs.** Number of filters per branch; kernel lengths in both Inception modules; depthwise kernel over channels (typically ``n_chans``); pooling lengths/strides; dropout rate; choice of activation.
|
|
93
|
-
- **Training tips.** Use 0-1000 ms windows at 128 Hz with CAR; tune activation and dropout (they strongly affect performance); early-stop on validation loss when overfitting emerges.
|
|
94
|
-
|
|
95
|
-
.. rubric:: Implementation Details
|
|
22
|
+
The code for the paper and this model is also available at [santamaria2020]_
|
|
23
|
+
and an adaptation for PyTorch [2]_.
|
|
96
24
|
|
|
97
25
|
The model is strongly based on the original InceptionNet for an image. The main goal is
|
|
98
26
|
to extract features in parallel with different scales. The authors extracted three scales
|
|
@@ -105,9 +33,12 @@ class EEGInceptionERP(EEGModuleMixin, nn.Sequential):
|
|
|
105
33
|
The winners of BEETL Competition/NeurIps 2021 used parts of the
|
|
106
34
|
model [beetl]_.
|
|
107
35
|
|
|
108
|
-
The
|
|
109
|
-
and an adaptation for PyTorch [2]_.
|
|
36
|
+
The model is fully described in [santamaria2020]_.
|
|
110
37
|
|
|
38
|
+
Notes
|
|
39
|
+
-----
|
|
40
|
+
This implementation is not guaranteed to be correct, has not been checked
|
|
41
|
+
by original authors, only reimplemented from the paper based on [2]_.
|
|
111
42
|
|
|
112
43
|
Parameters
|
|
113
44
|
----------
|
|
@@ -13,8 +13,6 @@ from braindecode.modules import Ensure4d
|
|
|
13
13
|
class EEGInceptionMI(EEGModuleMixin, nn.Module):
|
|
14
14
|
"""EEG Inception for Motor Imagery, as proposed in Zhang et al. (2021) [1]_
|
|
15
15
|
|
|
16
|
-
:bdg-success:`Convolution`
|
|
17
|
-
|
|
18
16
|
.. figure:: https://content.cld.iop.org/journals/1741-2552/18/4/046014/revision3/jneabed81f1_hr.jpg
|
|
19
17
|
:align: center
|
|
20
18
|
:alt: EEGInceptionMI Architecture
|