Braindecode 1.8.0__tar.gz → 1.8.0.dev1058__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.8.0.dev1058/NOTICE.txt +25 -0
- {braindecode-1.8.0/braindecode.egg-info → braindecode-1.8.0.dev1058}/PKG-INFO +5 -8
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058}/README.rst +3 -6
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058}/braindecode/datasets/base.py +0 -18
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058}/braindecode/functional/functions.py +3 -4
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058}/braindecode/models/atcnet.py +2 -2
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058}/braindecode/models/attn_sleep.py +28 -87
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058}/braindecode/models/base.py +3 -28
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058}/braindecode/models/brainmodule.py +1 -1
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058}/braindecode/models/ctnet.py +7 -10
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058}/braindecode/models/dance.py +10 -2
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058}/braindecode/models/eegconformer.py +1 -1
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058}/braindecode/models/eegminer.py +1 -2
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058}/braindecode/models/eegsimpleconv.py +7 -9
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058}/braindecode/models/emg2qwerty.py +133 -9
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058}/braindecode/models/ifnet.py +6 -10
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058}/braindecode/models/luna.py +5 -31
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058}/braindecode/models/medformer.py +1 -1
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058}/braindecode/models/meta_neuromotor.py +1 -1
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058}/braindecode/models/mvpformer.py +1 -1
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058}/braindecode/models/sleep_stager_blanco_2020.py +9 -5
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058}/braindecode/models/sleep_stager_chambon_2018.py +7 -1
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058}/braindecode/models/sparcnet.py +2 -2
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058}/braindecode/models/sstdpn.py +1 -1
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058}/braindecode/models/summary.csv +1 -1
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058}/braindecode/models/tcformer.py +1 -1
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058}/braindecode/models/tidnet.py +7 -1
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058}/braindecode/models/usleep.py +7 -3
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058}/braindecode/models/zuna.py +12 -26
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058}/braindecode/modules/__init__.py +2 -14
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058}/braindecode/modules/blocks.py +0 -213
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058}/braindecode/preprocessing/windowers.py +3 -26
- braindecode-1.8.0.dev1058/braindecode/version.py +1 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058}/braindecode/visualization/__init__.py +0 -6
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058/braindecode.egg-info}/PKG-INFO +5 -8
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058}/braindecode.egg-info/SOURCES.txt +0 -2
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058}/braindecode.egg-info/requires.txt +1 -1
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058}/docs/api.rst +0 -12
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058}/docs/whats_new.rst +2 -69
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058}/pyproject.toml +1 -1
- braindecode-1.8.0/NOTICE.txt +0 -65
- braindecode-1.8.0/braindecode/datasets/_notebook_viewer.py +0 -255
- braindecode-1.8.0/braindecode/version.py +0 -1
- braindecode-1.8.0/braindecode/visualization/activations.py +0 -77
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058}/LICENSE.txt +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058}/MANIFEST.in +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058}/braindecode/__init__.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058}/braindecode/augmentation/__init__.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058}/braindecode/augmentation/base.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058}/braindecode/augmentation/functional.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058}/braindecode/augmentation/transforms.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058}/braindecode/classifier.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058}/braindecode/datasets/__init__.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058}/braindecode/datasets/bbci.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058}/braindecode/datasets/bcicomp.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058}/braindecode/datasets/bids/__init__.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058}/braindecode/datasets/bids/datasets.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058}/braindecode/datasets/bids/format.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058}/braindecode/datasets/bids/hub.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058}/braindecode/datasets/bids/hub_format.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058}/braindecode/datasets/bids/hub_io.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058}/braindecode/datasets/bids/hub_validation.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058}/braindecode/datasets/bids/iterable.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058}/braindecode/datasets/chb_mit.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058}/braindecode/datasets/collate.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058}/braindecode/datasets/mne.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058}/braindecode/datasets/moabb.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058}/braindecode/datasets/nmt.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058}/braindecode/datasets/registry.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058}/braindecode/datasets/siena.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058}/braindecode/datasets/sleep_physio_challe_18.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058}/braindecode/datasets/sleep_physionet.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058}/braindecode/datasets/tuh.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058}/braindecode/datasets/utils.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058}/braindecode/datasets/xy.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058}/braindecode/datautil/__init__.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058}/braindecode/datautil/channel_utils.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058}/braindecode/datautil/hub_formats.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058}/braindecode/datautil/serialization.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058}/braindecode/datautil/util.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058}/braindecode/eegneuralnet.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058}/braindecode/functional/__init__.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058}/braindecode/functional/initialization.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058}/braindecode/models/__init__.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058}/braindecode/models/attentionbasenet.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058}/braindecode/models/bendr.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058}/braindecode/models/biot.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058}/braindecode/models/cbramod.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058}/braindecode/models/codebrain.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058}/braindecode/models/config.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058}/braindecode/models/contrawr.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058}/braindecode/models/deep4.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058}/braindecode/models/deepsleepnet.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058}/braindecode/models/dgcnn.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058}/braindecode/models/eegdino.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058}/braindecode/models/eeginception_erp.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058}/braindecode/models/eeginception_mi.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058}/braindecode/models/eegitnet.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058}/braindecode/models/eegnet.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058}/braindecode/models/eegnex.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058}/braindecode/models/eegpt.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058}/braindecode/models/eegsym.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058}/braindecode/models/eegtcnet.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058}/braindecode/models/fbcnet.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058}/braindecode/models/fblightconvnet.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058}/braindecode/models/fbmsnet.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058}/braindecode/models/hybrid.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058}/braindecode/models/interpolated.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058}/braindecode/models/labram.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058}/braindecode/models/msvtnet.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058}/braindecode/models/patchedtransformer.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058}/braindecode/models/reve.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058}/braindecode/models/sccnet.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058}/braindecode/models/shallow_fbcsp.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058}/braindecode/models/signal_jepa.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058}/braindecode/models/sinc_shallow.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058}/braindecode/models/steegformer.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058}/braindecode/models/syncnet.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058}/braindecode/models/tcn.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058}/braindecode/models/tsinception.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058}/braindecode/models/util.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058}/braindecode/modules/activation.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058}/braindecode/modules/attention.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058}/braindecode/modules/convolution.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058}/braindecode/modules/dance_modules.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058}/braindecode/modules/filter.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058}/braindecode/modules/interpolation.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058}/braindecode/modules/layers.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058}/braindecode/modules/linear.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058}/braindecode/modules/parametrization.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058}/braindecode/modules/stats.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058}/braindecode/modules/util.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058}/braindecode/modules/wrapper.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058}/braindecode/preprocessing/__init__.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058}/braindecode/preprocessing/eegprep_preprocess.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058}/braindecode/preprocessing/mne_preprocess.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058}/braindecode/preprocessing/preprocess.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058}/braindecode/preprocessing/util.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058}/braindecode/regressor.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058}/braindecode/samplers/__init__.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058}/braindecode/samplers/base.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058}/braindecode/samplers/ssl.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058}/braindecode/training/__init__.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058}/braindecode/training/callbacks.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058}/braindecode/training/losses.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058}/braindecode/training/scoring.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058}/braindecode/util.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058}/braindecode/visualization/attribution.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058}/braindecode/visualization/confusion_matrices.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058}/braindecode/visualization/frequency.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058}/braindecode/visualization/metrics.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058}/braindecode/visualization/sanity.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058}/braindecode/visualization/topology.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058}/braindecode.egg-info/dependency_links.txt +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058}/braindecode.egg-info/top_level.txt +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058}/docs/Makefile +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058}/docs/_templates/autosummary/class.rst +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058}/docs/_templates/autosummary/class_in_subdir.rst +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058}/docs/_templates/autosummary/function.rst +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058}/docs/_templates/autosummary/function_in_subdir.rst +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058}/docs/cite.rst +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058}/docs/conf.py +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058}/docs/help.rst +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058}/docs/index.rst +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058}/docs/install/install.rst +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058}/docs/install/install_pip.rst +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058}/docs/install/install_source.rst +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058}/docs/models/categorization/attention.rst +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058}/docs/models/categorization/channel.rst +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058}/docs/models/categorization/convolution.rst +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058}/docs/models/categorization/filterbank.rst +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058}/docs/models/categorization/gnn.rst +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058}/docs/models/categorization/interpretable.rst +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058}/docs/models/categorization/lbm.rst +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058}/docs/models/categorization/recurrent.rst +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058}/docs/models/categorization/spd.rst +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058}/docs/models/models.rst +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058}/docs/models/models_categorization.rst +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058}/docs/models/models_table.rst +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058}/docs/models/models_visualization.rst +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058}/docs/sg_execution_times.rst +0 -0
- {braindecode-1.8.0 → braindecode-1.8.0.dev1058}/setup.cfg +0 -0
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# BRAINDECODE Notice
|
|
2
|
+
|
|
3
|
+
## Licensed Components
|
|
4
|
+
|
|
5
|
+
### BSD-3-Clause Licensed Files
|
|
6
|
+
|
|
7
|
+
All files within the `src/` directory are licensed under the BSD-3-Clause License.
|
|
8
|
+
|
|
9
|
+
### CC BY-NC 4.0 Licensed Files
|
|
10
|
+
|
|
11
|
+
The following components are licensed under the Creative Commons Attribution-NonCommercial 4.0 International License:
|
|
12
|
+
|
|
13
|
+
- `braindecode/models/eegminer.py`
|
|
14
|
+
- `braindecode/models/meta_neuromotor.py`
|
|
15
|
+
|
|
16
|
+
As well as class later imported into the `braindecode.models.module` named as GeneralizedGaussianFilter.
|
|
17
|
+
|
|
18
|
+
The `meta_neuromotor.py` file is a derivative of
|
|
19
|
+
`facebookresearch/generic-neuromotor-interface`, released by Meta Platforms,
|
|
20
|
+
Inc. under CC BY-NC 4.0, and inherits the same noncommercial terms.
|
|
21
|
+
|
|
22
|
+
## License Links
|
|
23
|
+
|
|
24
|
+
- [BSD-3-Clause License](https://opensource.org/licenses/BSD-3-Clause)
|
|
25
|
+
- [CC BY-NC 4.0 License](https://creativecommons.org/licenses/by-nc/4.0/)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: braindecode
|
|
3
|
-
Version: 1.8.0
|
|
3
|
+
Version: 1.8.0.dev1058
|
|
4
4
|
Summary: Deep learning software to decode EEG, ECG or MEG signals
|
|
5
5
|
Author-email: Robin Tibor Schirrmeister <robintibor@gmail.com>, Bruno Aristimunha Pinto <b.aristimunha@gmail.com>, Alexandre Gramfort <agramfort@meta.com>
|
|
6
6
|
Maintainer-email: Alexandre Gramfort <agramfort@meta.com>, Bruno Aristimunha Pinto <b.aristimunha@gmail.com>, Robin Tibor Schirrmeister <robintibor@gmail.com>
|
|
@@ -34,6 +34,7 @@ Requires-Dist: pandas
|
|
|
34
34
|
Requires-Dist: wfdb>=4.3.1
|
|
35
35
|
Requires-Dist: linear_attention_transformer
|
|
36
36
|
Requires-Dist: docstring_inheritance
|
|
37
|
+
Requires-Dist: rotary_embedding_torch
|
|
37
38
|
Requires-Dist: pydantic>=2.0
|
|
38
39
|
Provides-Extra: moabb
|
|
39
40
|
Requires-Dist: moabb>=1.4.3; extra == "moabb"
|
|
@@ -50,7 +51,6 @@ Requires-Dist: pytest-cov; extra == "tests"
|
|
|
50
51
|
Requires-Dist: codecov; extra == "tests"
|
|
51
52
|
Requires-Dist: pytest_cases; extra == "tests"
|
|
52
53
|
Requires-Dist: mypy; extra == "tests"
|
|
53
|
-
Requires-Dist: ipython; extra == "tests"
|
|
54
54
|
Requires-Dist: transformers>=4.57.0; extra == "tests"
|
|
55
55
|
Requires-Dist: bids_validator; extra == "tests"
|
|
56
56
|
Provides-Extra: typing
|
|
@@ -260,10 +260,7 @@ This project is primarily licensed under the BSD-3-Clause License.
|
|
|
260
260
|
Additional Components
|
|
261
261
|
=====================
|
|
262
262
|
|
|
263
|
-
Some components within this repository are licensed under
|
|
264
|
-
|
|
265
|
-
Commons Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0), MIT
|
|
266
|
-
and Apache-2.0.
|
|
263
|
+
Some components within this repository are licensed under the Creative Commons
|
|
264
|
+
Attribution-NonCommercial 4.0 International License.
|
|
267
265
|
|
|
268
|
-
Please refer to the ``LICENSE`` and ``NOTICE`` files for
|
|
269
|
-
detailed information.
|
|
266
|
+
Please refer to the ``LICENSE`` and ``NOTICE`` files for more detailed information.
|
|
@@ -170,10 +170,7 @@ This project is primarily licensed under the BSD-3-Clause License.
|
|
|
170
170
|
Additional Components
|
|
171
171
|
=====================
|
|
172
172
|
|
|
173
|
-
Some components within this repository are licensed under
|
|
174
|
-
|
|
175
|
-
Commons Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0), MIT
|
|
176
|
-
and Apache-2.0.
|
|
173
|
+
Some components within this repository are licensed under the Creative Commons
|
|
174
|
+
Attribution-NonCommercial 4.0 International License.
|
|
177
175
|
|
|
178
|
-
Please refer to the ``LICENSE`` and ``NOTICE`` files for
|
|
179
|
-
detailed information.
|
|
176
|
+
Please refer to the ``LICENSE`` and ``NOTICE`` files for more detailed information.
|
|
@@ -32,7 +32,6 @@ from mne.utils.docs import deprecated
|
|
|
32
32
|
from torch.utils.data import ConcatDataset, Dataset, IterableDataset
|
|
33
33
|
from typing_extensions import TypeVar
|
|
34
34
|
|
|
35
|
-
from ._notebook_viewer import plot as _viewer_plot
|
|
36
35
|
from .bids.hub import HubDatasetMixin
|
|
37
36
|
from .bids.hub_io import _restore_nan_from_json
|
|
38
37
|
from .registry import register_dataset
|
|
@@ -60,7 +59,6 @@ def _html_row(label, value):
|
|
|
60
59
|
|
|
61
60
|
_METADATA_INTERNAL_COLS = {
|
|
62
61
|
"i_window_in_trial",
|
|
63
|
-
"i_trial_in_dataset",
|
|
64
62
|
"i_start_in_trial",
|
|
65
63
|
"i_stop_in_trial",
|
|
66
64
|
"target",
|
|
@@ -1175,8 +1173,6 @@ class BaseConcatDataset(ConcatDataset, HubDatasetMixin, Generic[T]):
|
|
|
1175
1173
|
If True, defer computing cumulative sizes until length or item access.
|
|
1176
1174
|
"""
|
|
1177
1175
|
|
|
1178
|
-
plot = _viewer_plot # eegdash-viewer embed; a direct member so the API docs list it
|
|
1179
|
-
|
|
1180
1176
|
datasets: list[T]
|
|
1181
1177
|
|
|
1182
1178
|
def __init__(
|
|
@@ -1378,20 +1374,6 @@ class BaseConcatDataset(ConcatDataset, HubDatasetMixin, Generic[T]):
|
|
|
1378
1374
|
"datasets are WindowsDataset."
|
|
1379
1375
|
)
|
|
1380
1376
|
|
|
1381
|
-
for ds in self.datasets:
|
|
1382
|
-
if hasattr(ds, "_windows") and ds._windows is not None:
|
|
1383
|
-
df = ds._windows.metadata
|
|
1384
|
-
else:
|
|
1385
|
-
df = ds.metadata
|
|
1386
|
-
if (
|
|
1387
|
-
"i_trial_in_dataset" in df.columns
|
|
1388
|
-
and "i_trial_in_dataset" in ds.description
|
|
1389
|
-
):
|
|
1390
|
-
raise ValueError(
|
|
1391
|
-
"Dataset descriptions cannot contain the reserved window "
|
|
1392
|
-
"metadata key 'i_trial_in_dataset'."
|
|
1393
|
-
)
|
|
1394
|
-
|
|
1395
1377
|
all_dfs = list()
|
|
1396
1378
|
for ds in self.datasets:
|
|
1397
1379
|
if hasattr(ds, "_windows") and ds._windows is not None:
|
|
@@ -40,7 +40,7 @@ def drop_path(
|
|
|
40
40
|
x : torch.Tensor
|
|
41
41
|
input tensor
|
|
42
42
|
drop_prob : float, optional
|
|
43
|
-
probability of
|
|
43
|
+
survival rate (i.e. probability of being kept), by default 0.0
|
|
44
44
|
training : bool, optional
|
|
45
45
|
whether the model is in training mode, by default False
|
|
46
46
|
scale_by_keep : bool, optional
|
|
@@ -68,10 +68,9 @@ def drop_path(
|
|
|
68
68
|
shape = (x.shape[0],) + (1,) * (
|
|
69
69
|
x.ndim - 1
|
|
70
70
|
) # work with diff dim tensors, not just 2D ConvNets
|
|
71
|
-
|
|
72
|
-
random_tensor = torch.bernoulli(probabilities).to(dtype=x.dtype)
|
|
71
|
+
random_tensor = x.new_empty(shape).bernoulli_(keep_prob)
|
|
73
72
|
if keep_prob > 0.0 and scale_by_keep:
|
|
74
|
-
random_tensor
|
|
73
|
+
random_tensor.div_(keep_prob)
|
|
75
74
|
return x * random_tensor
|
|
76
75
|
|
|
77
76
|
|
|
@@ -196,7 +196,7 @@ class ATCNet(EEGModuleMixin, nn.Module):
|
|
|
196
196
|
num_heads : int
|
|
197
197
|
Number of attention heads, denoted H in table 1 of the paper [1]_.
|
|
198
198
|
Defaults to 2 as in [1]_.
|
|
199
|
-
|
|
199
|
+
att_dropout : float
|
|
200
200
|
Dropout probability used in the attention block, denoted pa in table 1
|
|
201
201
|
of the paper [1]_. Defaults to 0.5 as in [1]_.
|
|
202
202
|
tcn_depth : int
|
|
@@ -206,7 +206,7 @@ class ATCNet(EEGModuleMixin, nn.Module):
|
|
|
206
206
|
tcn_kernel_size : int
|
|
207
207
|
Temporal kernel size used in TCN block, denoted Kt in table 1 of the
|
|
208
208
|
paper [1]_. Defaults to 4 as in [1]_.
|
|
209
|
-
|
|
209
|
+
tcn_dropout : float
|
|
210
210
|
Dropout probability used in the TCN block, denoted pt in table 1
|
|
211
211
|
of the paper [1]_. Defaults to 0.3 as in [1]_.
|
|
212
212
|
tcn_activation : torch.nn.Module
|
|
@@ -1,36 +1,10 @@
|
|
|
1
1
|
# Authors: Divyesh Narayanan <divyesh.narayanan@gmail.com>
|
|
2
|
-
# Sarthak Tayal <sarthaktayal2@gmail.com>
|
|
3
2
|
#
|
|
4
3
|
# License: BSD (3-clause)
|
|
5
|
-
#
|
|
6
|
-
# This implementation derives from https://github.com/emadeldeen24/AttnSleep:
|
|
7
|
-
#
|
|
8
|
-
# MIT License
|
|
9
|
-
#
|
|
10
|
-
# Copyright (c) 2020 Emadeldeen Eldele
|
|
11
|
-
#
|
|
12
|
-
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
13
|
-
# of this software and associated documentation files (the "Software"), to deal
|
|
14
|
-
# in the Software without restriction, including without limitation the rights
|
|
15
|
-
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
16
|
-
# copies of the Software, and to permit persons to whom the Software is
|
|
17
|
-
# furnished to do so, subject to the following conditions:
|
|
18
|
-
#
|
|
19
|
-
# The above copyright notice and this permission notice shall be included in all
|
|
20
|
-
# copies or substantial portions of the Software.
|
|
21
|
-
#
|
|
22
|
-
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
23
|
-
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
24
|
-
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
25
|
-
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
26
|
-
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
27
|
-
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
28
|
-
# SOFTWARE.
|
|
29
4
|
|
|
30
5
|
import math
|
|
31
6
|
import warnings
|
|
32
7
|
from copy import deepcopy
|
|
33
|
-
from numbers import Integral
|
|
34
8
|
|
|
35
9
|
import torch
|
|
36
10
|
import torch.nn.functional as F
|
|
@@ -59,8 +33,7 @@ class AttnSleep(EEGModuleMixin, nn.Module):
|
|
|
59
33
|
|
|
60
34
|
Warning - This model was designed for signals of 30 seconds at 100Hz or 125Hz (in which case
|
|
61
35
|
the reference architecture from [1]_ which was validated on SHHS dataset [2]_ will be used)
|
|
62
|
-
to use any other input is likely to make the model perform in unintended ways.
|
|
63
|
-
window length also needs a ``d_model`` of its own, see the parameter below.
|
|
36
|
+
to use any other input is likely to make the model perform in unintended ways.
|
|
64
37
|
|
|
65
38
|
Parameters
|
|
66
39
|
----------
|
|
@@ -71,10 +44,7 @@ class AttnSleep(EEGModuleMixin, nn.Module):
|
|
|
71
44
|
Also the input dimension of the first FC layer in the feed forward
|
|
72
45
|
and the output of the second FC layer in the same.
|
|
73
46
|
Increase for higher sampling rate/signal length.
|
|
74
|
-
It should be divisible by n_attn_heads
|
|
75
|
-
of time steps returned by the feature extractor: 80 for 30 seconds at
|
|
76
|
-
100 Hz and 100 for 30 seconds at 125 Hz. A construction error reports
|
|
77
|
-
the value needed for other window lengths.
|
|
47
|
+
It should be divisible by n_attn_heads
|
|
78
48
|
d_ff : int
|
|
79
49
|
Output dimension of the first FC layer in the feed forward and the
|
|
80
50
|
input dimension of the second FC layer in the same.
|
|
@@ -88,12 +58,15 @@ class AttnSleep(EEGModuleMixin, nn.Module):
|
|
|
88
58
|
If True, return the features, i.e. the output of the feature extractor
|
|
89
59
|
(before the final linear layer). If False, pass the features through
|
|
90
60
|
the final linear layer.
|
|
61
|
+
n_classes : int
|
|
62
|
+
Alias for `n_outputs`.
|
|
63
|
+
input_size_s : float
|
|
64
|
+
Alias for `input_window_seconds`.
|
|
91
65
|
activation : nn.Module, default=nn.ReLU
|
|
92
|
-
Activation function class to apply
|
|
93
|
-
feed-forward block. Should be a PyTorch activation
|
|
66
|
+
Activation function class to apply. Should be a PyTorch activation
|
|
94
67
|
module class like ``nn.ReLU`` or ``nn.ELU``. Default is ``nn.ReLU``.
|
|
95
|
-
activation_mrcnn : nn.Module, default=nn.
|
|
96
|
-
Activation function class to apply in the
|
|
68
|
+
activation_mrcnn : nn.Module, default=nn.ReLU
|
|
69
|
+
Activation function class to apply in the Mask R-CNN layer.
|
|
97
70
|
Should be a PyTorch activation module class like ``nn.ReLU`` or
|
|
98
71
|
``nn.GELU``. Default is ``nn.GELU``.
|
|
99
72
|
|
|
@@ -126,14 +99,6 @@ class AttnSleep(EEGModuleMixin, nn.Module):
|
|
|
126
99
|
n_chans=None,
|
|
127
100
|
n_times=None,
|
|
128
101
|
):
|
|
129
|
-
if (
|
|
130
|
-
sum(value is not None for value in (n_times, sfreq, input_window_seconds))
|
|
131
|
-
< 2
|
|
132
|
-
):
|
|
133
|
-
raise ValueError(
|
|
134
|
-
"AttnSleep requires at least two of n_times, sfreq, and "
|
|
135
|
-
"input_window_seconds."
|
|
136
|
-
)
|
|
137
102
|
super().__init__(
|
|
138
103
|
n_outputs=n_outputs,
|
|
139
104
|
n_chans=n_chans,
|
|
@@ -175,14 +140,6 @@ class AttnSleep(EEGModuleMixin, nn.Module):
|
|
|
175
140
|
activation=activation_mrcnn,
|
|
176
141
|
activation_se=activation,
|
|
177
142
|
)
|
|
178
|
-
feature_length = self._feature_length(mrcnn, self.n_times)
|
|
179
|
-
if feature_length != d_model:
|
|
180
|
-
raise ValueError(
|
|
181
|
-
f"d_model is {d_model} but the feature extractor returns "
|
|
182
|
-
f"{feature_length} time steps for an input of {self.n_times} "
|
|
183
|
-
f"samples at {self.sfreq} Hz. Set d_model={feature_length}, with "
|
|
184
|
-
"an n_attn_heads that divides it."
|
|
185
|
-
)
|
|
186
143
|
attn = _MultiHeadedAttention(n_attn_heads, d_model, after_reduced_cnn_size)
|
|
187
144
|
ff = _PositionwiseFeedForward(d_model, d_ff, drop_prob, activation=activation)
|
|
188
145
|
tce = _TCE(
|
|
@@ -193,26 +150,23 @@ class AttnSleep(EEGModuleMixin, nn.Module):
|
|
|
193
150
|
)
|
|
194
151
|
|
|
195
152
|
self.feature_extractor = nn.Sequential(mrcnn, tce)
|
|
196
|
-
self.len_last_layer =
|
|
153
|
+
self.len_last_layer = self._len_last_layer(self.n_times)
|
|
197
154
|
self.return_feats = return_feats
|
|
198
155
|
|
|
199
156
|
# TODO: Add new way to handle return features
|
|
200
157
|
"""if return_feats:
|
|
201
158
|
raise ValueError("return_feat == True is not accepted anymore")"""
|
|
202
159
|
if not return_feats:
|
|
203
|
-
self.final_layer = nn.Linear(
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
for module, was_training in training_states:
|
|
214
|
-
module.training = was_training
|
|
215
|
-
return out.shape[-1]
|
|
160
|
+
self.final_layer = nn.Linear(
|
|
161
|
+
d_model * after_reduced_cnn_size, self.n_outputs
|
|
162
|
+
)
|
|
163
|
+
|
|
164
|
+
def _len_last_layer(self, input_size):
|
|
165
|
+
self.feature_extractor.eval()
|
|
166
|
+
with torch.no_grad():
|
|
167
|
+
out = self.feature_extractor(torch.Tensor(1, 1, input_size))
|
|
168
|
+
self.feature_extractor.train()
|
|
169
|
+
return len(out.flatten())
|
|
216
170
|
|
|
217
171
|
def forward(self, x: torch.Tensor) -> torch.Tensor:
|
|
218
172
|
"""
|
|
@@ -241,7 +195,7 @@ class _SELayer(nn.Module):
|
|
|
241
195
|
self.avg_pool = nn.AdaptiveAvgPool1d(1)
|
|
242
196
|
self.fc = nn.Sequential(
|
|
243
197
|
nn.Linear(channel, channel // reduction, bias=False),
|
|
244
|
-
activation(),
|
|
198
|
+
activation(inplace=True),
|
|
245
199
|
nn.Linear(channel // reduction, channel, bias=False),
|
|
246
200
|
nn.Sigmoid(),
|
|
247
201
|
)
|
|
@@ -282,10 +236,10 @@ class _SEBasicBlock(nn.Module):
|
|
|
282
236
|
super(_SEBasicBlock, self).__init__()
|
|
283
237
|
self.conv1 = nn.Conv1d(inplanes, planes, stride)
|
|
284
238
|
self.bn1 = nn.BatchNorm1d(planes)
|
|
285
|
-
self.relu = activation()
|
|
239
|
+
self.relu = activation(inplace=True)
|
|
286
240
|
self.conv2 = nn.Conv1d(planes, planes, 1)
|
|
287
241
|
self.bn2 = nn.BatchNorm1d(planes)
|
|
288
|
-
self.se = _SELayer(planes, reduction
|
|
242
|
+
self.se = _SELayer(planes, reduction)
|
|
289
243
|
self.downsample = downsample
|
|
290
244
|
self.stride = stride
|
|
291
245
|
self.features = nn.Sequential(
|
|
@@ -366,11 +320,11 @@ class _MRCNN(nn.Module):
|
|
|
366
320
|
self.dropout = nn.Dropout(drate)
|
|
367
321
|
self.inplanes = 128
|
|
368
322
|
self.AFR = self._make_layer(
|
|
369
|
-
_SEBasicBlock, after_reduced_cnn_size, 1,
|
|
323
|
+
_SEBasicBlock, after_reduced_cnn_size, 1, activate=activation_se
|
|
370
324
|
)
|
|
371
325
|
|
|
372
326
|
def _make_layer(
|
|
373
|
-
self, block, planes, blocks, stride=1,
|
|
327
|
+
self, block, planes, blocks, stride=1, activate: type[nn.Module] = nn.ReLU
|
|
374
328
|
): # makes residual SE block
|
|
375
329
|
downsample = None
|
|
376
330
|
if stride != 1 or self.inplanes != planes * block.expansion:
|
|
@@ -386,12 +340,10 @@ class _MRCNN(nn.Module):
|
|
|
386
340
|
)
|
|
387
341
|
|
|
388
342
|
layers = []
|
|
389
|
-
layers.append(
|
|
390
|
-
block(self.inplanes, planes, stride, downsample, activation=activation)
|
|
391
|
-
)
|
|
343
|
+
layers.append(block(self.inplanes, planes, stride, downsample))
|
|
392
344
|
self.inplanes = planes * block.expansion
|
|
393
345
|
for i in range(1, blocks):
|
|
394
|
-
layers.append(block(self.inplanes, planes,
|
|
346
|
+
layers.append(block(self.inplanes, planes, activate=activate))
|
|
395
347
|
|
|
396
348
|
return nn.Sequential(*layers)
|
|
397
349
|
|
|
@@ -423,20 +375,9 @@ class _MultiHeadedAttention(nn.Module):
|
|
|
423
375
|
def __init__(self, h, d_model, after_reduced_cnn_size, dropout=0.1):
|
|
424
376
|
"""Take in model size and number of heads."""
|
|
425
377
|
super().__init__()
|
|
426
|
-
|
|
427
|
-
isinstance(h, bool)
|
|
428
|
-
or not isinstance(h, Integral)
|
|
429
|
-
or h <= 0
|
|
430
|
-
or d_model % h != 0
|
|
431
|
-
):
|
|
432
|
-
raise ValueError(
|
|
433
|
-
"n_attn_heads must be a positive integer that divides d_model, "
|
|
434
|
-
f"got n_attn_heads={h!r} and d_model={d_model}."
|
|
435
|
-
)
|
|
436
|
-
h = int(h)
|
|
378
|
+
assert d_model % h == 0
|
|
437
379
|
self.d_per_head = d_model // h
|
|
438
380
|
self.h = h
|
|
439
|
-
self.attn = torch.empty(0)
|
|
440
381
|
|
|
441
382
|
base_conv = CausalConv1d(
|
|
442
383
|
in_channels=after_reduced_cnn_size,
|
|
@@ -80,7 +80,7 @@ class _BraindecodeDocstringMeta(NumpyDocstringInheritanceInitMeta):
|
|
|
80
80
|
unwrapped function and correctly inherits ``cls.__doc__``.
|
|
81
81
|
"""
|
|
82
82
|
|
|
83
|
-
def __init__(cls, class_name, class_bases, class_dict
|
|
83
|
+
def __init__(cls, class_name, class_bases, class_dict):
|
|
84
84
|
super().__init__(class_name, class_bases, class_dict)
|
|
85
85
|
# Only wrap subclass __init__s, not EEGModuleMixin itself.
|
|
86
86
|
# Wrapping the mixin would cause super().__init__() calls to
|
|
@@ -214,8 +214,6 @@ class EEGModuleMixin(_BaseHubMixin, metaclass=_BraindecodeDocstringMeta):
|
|
|
214
214
|
__jit_unused_properties__ = ["chs_info"]
|
|
215
215
|
|
|
216
216
|
def __init_subclass__(cls, **kwargs):
|
|
217
|
-
license = kwargs.pop("license", "bsd-3-clause")
|
|
218
|
-
|
|
219
217
|
# TorchScript only honours ``__jit_ignored_attributes__`` for
|
|
220
218
|
# properties defined directly on the concrete class: it collects them
|
|
221
219
|
# with ``vars(type(module))``, which skips inherited ones. Rebinding
|
|
@@ -255,6 +253,8 @@ class EEGModuleMixin(_BaseHubMixin, metaclass=_BraindecodeDocstringMeta):
|
|
|
255
253
|
)
|
|
256
254
|
repo_url = kwargs.pop("repo_url", "https://braindecode.org")
|
|
257
255
|
library_name = kwargs.pop("library_name", "braindecode")
|
|
256
|
+
license = kwargs.pop("license", "bsd-3-clause")
|
|
257
|
+
|
|
258
258
|
# Register a coder so that type[nn.Module] parameters
|
|
259
259
|
# (e.g. activation=nn.ELU) are serialized as importable
|
|
260
260
|
# strings in config.json and decoded back on load.
|
|
@@ -519,31 +519,6 @@ class EEGModuleMixin(_BaseHubMixin, metaclass=_BraindecodeDocstringMeta):
|
|
|
519
519
|
resolve_type_kwargs(cls, config)
|
|
520
520
|
return cls(**config)
|
|
521
521
|
|
|
522
|
-
def _set_n_outputs(self, n_outputs: int) -> None:
|
|
523
|
-
"""Record a new ``n_outputs`` on the model and its saved configs.
|
|
524
|
-
|
|
525
|
-
Helper for :meth:`reset_head` implementations: validates the value,
|
|
526
|
-
then keeps the ``n_outputs`` property, the braindecode init kwargs
|
|
527
|
-
and the Hugging Face hub config in sync, so a re-serialized model
|
|
528
|
-
reports the head it actually has.
|
|
529
|
-
|
|
530
|
-
Parameters
|
|
531
|
-
----------
|
|
532
|
-
n_outputs : int
|
|
533
|
-
New number of outputs. Must be positive.
|
|
534
|
-
|
|
535
|
-
.. versionadded:: 1.8
|
|
536
|
-
"""
|
|
537
|
-
if n_outputs <= 0:
|
|
538
|
-
raise ValueError(f"n_outputs must be positive; got {n_outputs}.")
|
|
539
|
-
self._n_outputs = n_outputs
|
|
540
|
-
for config in (
|
|
541
|
-
getattr(self, "_braindecode_init_kwargs", None),
|
|
542
|
-
getattr(self, "_hub_mixin_config", None),
|
|
543
|
-
):
|
|
544
|
-
if config is not None and "n_outputs" in config:
|
|
545
|
-
config["n_outputs"] = n_outputs
|
|
546
|
-
|
|
547
522
|
def reset_head(self, n_outputs):
|
|
548
523
|
"""Replace the classification head for a new number of outputs.
|
|
549
524
|
|
|
@@ -25,7 +25,7 @@ from braindecode.modules.layers import SubjectLayers
|
|
|
25
25
|
__all__ = ["BrainModule"]
|
|
26
26
|
|
|
27
27
|
|
|
28
|
-
class BrainModule(EEGModuleMixin, nn.Module
|
|
28
|
+
class BrainModule(EEGModuleMixin, nn.Module):
|
|
29
29
|
r"""BrainModule from [brainmagick]_, also known as SimpleConv.
|
|
30
30
|
|
|
31
31
|
A dilated convolutional encoder for EEG decoding, using residual
|
|
@@ -24,7 +24,7 @@ from braindecode.modules import (
|
|
|
24
24
|
)
|
|
25
25
|
|
|
26
26
|
|
|
27
|
-
class CTNet(EEGModuleMixin, nn.Module
|
|
27
|
+
class CTNet(EEGModuleMixin, nn.Module):
|
|
28
28
|
r"""CTNet from Zhao, W et al (2024) [ctnet]_.
|
|
29
29
|
|
|
30
30
|
:bdg-success:`Convolution` :bdg-info:`Attention/Transformer`
|
|
@@ -59,19 +59,16 @@ class CTNet(EEGModuleMixin, nn.Module, license="mit"):
|
|
|
59
59
|
|
|
60
60
|
Parameters
|
|
61
61
|
----------
|
|
62
|
-
|
|
63
|
-
Activation function to use in the
|
|
64
|
-
activation_transformer : nn.Module, default=nn.GELU
|
|
65
|
-
Activation function to use in the Transformer encoder.
|
|
62
|
+
activation : nn.Module, default=nn.GELU
|
|
63
|
+
Activation function to use in the network.
|
|
66
64
|
num_heads : int, default=4
|
|
67
65
|
Number of attention heads in the Transformer encoder.
|
|
68
|
-
embed_dim : int or None, default=
|
|
66
|
+
embed_dim : int or None, default=None
|
|
69
67
|
Embedding size (dimensionality) for the Transformer encoder.
|
|
70
68
|
num_layers : int, default=6
|
|
71
69
|
Number of encoder layers in the Transformer.
|
|
72
|
-
n_filters_time : int
|
|
73
|
-
Number of temporal filters in the first convolutional layer.
|
|
74
|
-
from ``embed_dim`` and ``depth_multiplier`` when left at ``None``.
|
|
70
|
+
n_filters_time : int, default=20
|
|
71
|
+
Number of temporal filters in the first convolutional layer.
|
|
75
72
|
kernel_size : int, default=64
|
|
76
73
|
Kernel size for the temporal convolutional layer.
|
|
77
74
|
depth_multiplier : int, default=2
|
|
@@ -80,7 +77,7 @@ class CTNet(EEGModuleMixin, nn.Module, license="mit"):
|
|
|
80
77
|
Pooling size for the first average pooling layer.
|
|
81
78
|
pool_size_2 : int, default=8
|
|
82
79
|
Pooling size for the second average pooling layer.
|
|
83
|
-
|
|
80
|
+
cnn_drop_prob: float, default=0.3
|
|
84
81
|
Dropout probability after convolutional layers.
|
|
85
82
|
att_positional_drop_prob : float, default=0.1
|
|
86
83
|
Dropout probability for the positional encoding in the Transformer.
|
|
@@ -22,7 +22,7 @@ from braindecode.modules import ChannelMerger, Perceiver, SimpleConv
|
|
|
22
22
|
from braindecode.modules.dance_modules import DanceDetrDecoder
|
|
23
23
|
|
|
24
24
|
|
|
25
|
-
class DANCE(EEGModuleMixin, nn.Module
|
|
25
|
+
class DANCE(EEGModuleMixin, nn.Module):
|
|
26
26
|
r"""DANCE from Lévy et al (2026) [dance]_.
|
|
27
27
|
|
|
28
28
|
:bdg-success:`Convolution` :bdg-info:`Attention/Transformer` :bdg-dark-line:`Channel`
|
|
@@ -349,7 +349,8 @@ class DANCE(EEGModuleMixin, nn.Module, license="mit"):
|
|
|
349
349
|
|
|
350
350
|
def reset_head(self, n_outputs: int) -> None:
|
|
351
351
|
"""Replace the dense head and the DETR class head for a new ``n_outputs``."""
|
|
352
|
-
|
|
352
|
+
if n_outputs <= 0:
|
|
353
|
+
raise ValueError(f"n_outputs must be positive; got {n_outputs}.")
|
|
353
354
|
old = self.final_layer
|
|
354
355
|
self.final_layer = nn.Linear(old.in_features, n_outputs).to(
|
|
355
356
|
device=old.weight.device, dtype=old.weight.dtype
|
|
@@ -358,3 +359,10 @@ class DANCE(EEGModuleMixin, nn.Module, license="mit"):
|
|
|
358
359
|
self.decoder.class_head = nn.Linear(ch.in_features, n_outputs).to(
|
|
359
360
|
device=ch.weight.device, dtype=ch.weight.dtype
|
|
360
361
|
)
|
|
362
|
+
self._n_outputs = n_outputs
|
|
363
|
+
init_kwargs = getattr(self, "_braindecode_init_kwargs", None)
|
|
364
|
+
if init_kwargs is not None and "n_outputs" in init_kwargs:
|
|
365
|
+
init_kwargs["n_outputs"] = n_outputs
|
|
366
|
+
hub_config = getattr(self, "_hub_mixin_config", None)
|
|
367
|
+
if hub_config is not None and "n_outputs" in hub_config:
|
|
368
|
+
hub_config["n_outputs"] = n_outputs
|
|
@@ -185,7 +185,7 @@ class EEGConformer(EEGModuleMixin, nn.Module):
|
|
|
185
185
|
31, pp.710-719. https://ieeexplore.ieee.org/document/9991178
|
|
186
186
|
.. [ConformerCode] Song, Y., Zheng, Q., Liu, B. and Gao, X., 2022. EEG
|
|
187
187
|
conformer: Convolutional transformer for EEG decoding and visualization.
|
|
188
|
-
https://github.com/eeyhsong/EEG-Conformer
|
|
188
|
+
https://github.com/eeyhsong/EEG-Conformer.
|
|
189
189
|
"""
|
|
190
190
|
|
|
191
191
|
def __init__(
|
|
@@ -6,7 +6,6 @@
|
|
|
6
6
|
"""
|
|
7
7
|
|
|
8
8
|
# Authors: Sarthak Tayal <sarthaktayal2@gmail.com>
|
|
9
|
-
# License: Creative Commons Attribution-NonCommercial 4.0 International (CC BY-NC 4.0)
|
|
10
9
|
|
|
11
10
|
import torch
|
|
12
11
|
from torch import nn
|
|
@@ -49,7 +48,7 @@ class _EEGMinerFeatures(nn.Module):
|
|
|
49
48
|
return x[:, self.triu_row, self.triu_col, :]
|
|
50
49
|
|
|
51
50
|
|
|
52
|
-
class EEGMiner(EEGModuleMixin, nn.Module
|
|
51
|
+
class EEGMiner(EEGModuleMixin, nn.Module):
|
|
53
52
|
r"""EEGMiner from Ludwig et al (2024) [eegminer]_.
|
|
54
53
|
|
|
55
54
|
:bdg-success:`Convolution` :bdg-warning:`Interpretability`
|
|
@@ -71,19 +71,17 @@ class EEGSimpleConv(EEGModuleMixin, torch.nn.Module):
|
|
|
71
71
|
|
|
72
72
|
Parameters
|
|
73
73
|
----------
|
|
74
|
-
feature_maps
|
|
74
|
+
feature_maps: int
|
|
75
75
|
Number of Feature Maps at the first Convolution, width of the model.
|
|
76
|
-
n_convs
|
|
76
|
+
n_convs: int
|
|
77
77
|
Number of blocks of convolutions (2 convolutions per block), depth of the model.
|
|
78
|
-
|
|
78
|
+
resampling: int
|
|
79
79
|
Resampling Frequency.
|
|
80
|
-
kernel_size
|
|
80
|
+
kernel_size: int
|
|
81
81
|
Size of the convolutions kernels.
|
|
82
|
-
|
|
83
|
-
If True, return the features before the final linear layer.
|
|
84
|
-
activation : nn.Module, default=nn.ReLU
|
|
82
|
+
activation: nn.Module, default=nn.ELU
|
|
85
83
|
Activation function class to apply. Should be a PyTorch activation
|
|
86
|
-
module class like ``nn.ReLU`` or ``nn.ELU``. Default is ``nn.
|
|
84
|
+
module class like ``nn.ReLU`` or ``nn.ELU``. Default is ``nn.ELU``.
|
|
87
85
|
|
|
88
86
|
References
|
|
89
87
|
----------
|
|
@@ -93,7 +91,7 @@ class EEGSimpleConv(EEGModuleMixin, torch.nn.Module):
|
|
|
93
91
|
.. [Yassine2023Code] Yassine El Ouahidi, V. Gripon, B. Pasdeloup, G. Bouallegue
|
|
94
92
|
N. Farrugia, G. Lioi, 2023. A Strong and Simple Deep Learning Baseline for
|
|
95
93
|
BCI Motor Imagery Decoding. GitHub repository.
|
|
96
|
-
https://github.com/elouayas/EEGSimpleConv
|
|
94
|
+
https://github.com/elouayas/EEGSimpleConv.
|
|
97
95
|
|
|
98
96
|
"""
|
|
99
97
|
|