| --- |
| license: bsd-3-clause |
| library_name: braindecode |
| pipeline_tag: feature-extraction |
| tags: |
| - eeg |
| - biosignal |
| - pytorch |
| - neuroscience |
| - braindecode |
| - convolutional |
| --- |
| |
| # Deep4Net |
|
|
| Deep ConvNet model from Schirrmeister et al (2017) [Schirrmeister2017]. |
|
|
| > **Architecture-only repository.** Documents the |
| > `braindecode.models.Deep4Net` class. **No pretrained weights are |
| > distributed here.** Instantiate the model and train it on your own |
| > data. |
|
|
| ## Quick start |
|
|
| ```bash |
| pip install braindecode |
| ``` |
|
|
| ```python |
| from braindecode.models import Deep4Net |
| |
| model = Deep4Net( |
| n_chans=22, |
| sfreq=250, |
| input_window_seconds=4.0, |
| n_outputs=4, |
| ) |
| ``` |
|
|
| The signal-shape arguments above are illustrative defaults β adjust to |
| match your recording. |
|
|
| ## Documentation |
| - Full API reference: <https://braindecode.org/stable/generated/braindecode.models.Deep4Net.html> |
| - Interactive browser (live instantiation, parameter counts): |
| <https://huggingface.co/spaces/braindecode/model-explorer> |
| - Source on GitHub: <https://github.com/braindecode/braindecode/blob/master/braindecode/models/deep4.py#L19> |
|
|
|
|
| ## Architecture |
|
|
|  |
|
|
|
|
| ## Parameters |
|
|
| | Parameter | Type | Description | |
| |---|---|---| |
| | `final_conv_length: int | str` | β | Length of the final convolution layer. If set to "auto", n_times must not be None. Default: "auto". | |
| | `n_filters_time: int` | β | Number of temporal filters. | |
| | `n_filters_spat: int` | β | Number of spatial filters. | |
| | `filter_time_length: int` | β | Length of the temporal filter in layer 1. | |
| | `pool_time_length: int` | β | Length of temporal pooling filter. | |
| | `pool_time_stride: int` | β | Length of stride between temporal pooling filters. | |
| | `n_filters_2: int` | β | Number of temporal filters in layer 2. | |
| | `filter_length_2: int` | β | Length of the temporal filter in layer 2. | |
| | `n_filters_3: int` | β | Number of temporal filters in layer 3. | |
| | `filter_length_3: int` | β | Length of the temporal filter in layer 3. | |
| | `n_filters_4: int` | β | Number of temporal filters in layer 4. | |
| | `filter_length_4: int` | β | Length of the temporal filter in layer 4. | |
| | `activation_first_conv_nonlin: nn.Module, default is nn.ELU` | β | Non-linear activation function to be used after convolution in layer 1. | |
| | `first_pool_mode: str` | β | Pooling mode in layer 1. "max" or "mean". | |
| | `first_pool_nonlin: callable` | β | Non-linear activation function to be used after pooling in layer 1. | |
| | `activation_later_conv_nonlin: nn.Module, default is nn.ELU` | β | Non-linear activation function to be used after convolution in later layers. | |
| | `later_pool_mode: str` | β | Pooling mode in later layers. "max" or "mean". | |
| | `later_pool_nonlin: callable` | β | Non-linear activation function to be used after pooling in later layers. | |
| | `drop_prob: float` | β | Dropout probability. | |
| | `split_first_layer: bool` | β | Split first layer into temporal and spatial layers (True) or just use temporal (False). There would be no non-linearity between the split layers. | |
| | `batch_norm: bool` | β | Whether to use batch normalisation. | |
| | `batch_norm_alpha: float` | β | Momentum for BatchNorm2d. | |
| | `stride_before_pool: bool` | β | Stride before pooling. | |
|
|
|
|
| ## References |
|
|
| 1. Schirrmeister, R. T., Springenberg, J. T., Fiederer, L. D. J., Glasstetter, M., Eggensperger, K., Tangermann, M., Hutter, F. & Ball, T. (2017). Deep learning with convolutional neural networks for EEG decoding and visualization. Human Brain Mapping , Aug. 2017. Online: http://dx.doi.org/10.1002/hbm.23730 |
|
|
|
|
| ## Citation |
|
|
| Cite the original architecture paper (see *References* above) and braindecode: |
|
|
| ```bibtex |
| @article{aristimunha2025braindecode, |
| title = {Braindecode: a deep learning library for raw electrophysiological data}, |
| author = {Aristimunha, Bruno and others}, |
| journal = {Zenodo}, |
| year = {2025}, |
| doi = {10.5281/zenodo.17699192}, |
| } |
| ``` |
|
|
| ## License |
|
|
| BSD-3-Clause for the model code (matching braindecode). |
| Pretraining-derived weights, if you fine-tune from a checkpoint, |
| inherit the licence of that checkpoint and its training corpus. |
|
|