--- license: bsd-3-clause library_name: braindecode pipeline_tag: feature-extraction tags: - eeg - biosignal - pytorch - neuroscience - braindecode - convolutional --- # EEGSimpleConv EEGSimpleConv from Ouahidi, YE et al (2023) . > **Architecture-only repository.** This repo documents the > `braindecode.models.EEGSimpleConv` class. **No pretrained weights are > distributed here** — instantiate the model and train it on your own > data, or fine-tune from a published foundation-model checkpoint > separately. ## Quick start ```bash pip install braindecode ``` ```python from braindecode.models import EEGSimpleConv model = EEGSimpleConv( n_chans=22, sfreq=250, input_window_seconds=4.0, n_outputs=4, ) ``` The signal-shape arguments above are example defaults — adjust them to match your recording. ## Documentation - Full API reference (parameters, references, architecture figure): - Interactive browser with live instantiation: - Source on GitHub: ## Architecture description The block below is the rendered class docstring (parameters, references, architecture figure where available).

EEGSimpleConv from Ouahidi, YE et al (2023) [Yassine2023]_.

Convolution .. figure:: https://raw.githubusercontent.com/elouayas/EEGSimpleConv/refs/heads/main/architecture.png :align: center :alt: EEGSimpleConv Architecture EEGSimpleConv is a 1D Convolutional Neural Network originally designed for decoding motor imagery from EEG signals. The model aims to have a very simple and straightforward architecture that allows a low latency, while still achieving very competitive performance. EEG-SimpleConv starts with a 1D convolutional layer, where each EEG channel enters a separate 1D convolutional channel. This is followed by a series of blocks of two 1D convolutional layers. Between the two convolutional layers of each block is a max pooling layer, which downsamples the data by a factor of 2. Each convolution is followed by a batch normalisation layer and a ReLU activation function. Finally, a global average pooling (in the time domain) is performed to obtain a single value per feature map, which is then fed into a linear layer to obtain the final classification prediction output. The paper and original code with more details about the methodological choices are available at the [Yassine2023]_ and [Yassine2023Code]_. The input shape should be three-dimensional matrix representing the EEG signals. ``(batch_size, n_channels, n_timesteps)``. Notes ----- The authors recommend using the default parameters for MI decoding. Please refer to the original paper and code for more details. Recommended range for the choice of the hyperparameters, regarding the evaluation paradigm. | Parameter | Within-Subject | Cross-Subject | | feature_maps | [64-144] | [64-144] | | n_convs | 1 | [2-4] | | resampling_freq | [70-100] | [50-80] | | kernel_size | [12-17] | [5-8] | An intensive ablation study is included in the paper to understand the of each parameter on the model performance. .. versionadded:: 0.9 Parameters ---------- feature_maps: int Number of Feature Maps at the first Convolution, width of the model. n_convs: int Number of blocks of convolutions (2 convolutions per block), depth of the model. resampling: int Resampling Frequency. kernel_size: int Size of the convolutions kernels. activation: nn.Module, default=nn.ELU Activation function class to apply. Should be a PyTorch activation module class like ``nn.ReLU`` or ``nn.ELU``. Default is ``nn.ELU``. References ---------- .. [Yassine2023] Yassine El Ouahidi, V. Gripon, B. Pasdeloup, G. Bouallegue N. Farrugia, G. Lioi, 2023. A Strong and Simple Deep Learning Baseline for BCI Motor Imagery Decoding. Arxiv preprint. arxiv.org/abs/2309.07159 .. [Yassine2023Code] Yassine El Ouahidi, V. Gripon, B. Pasdeloup, G. Bouallegue N. Farrugia, G. Lioi, 2023. A Strong and Simple Deep Learning Baseline for BCI Motor Imagery Decoding. GitHub repository. https://github.com/elouayas/EEGSimpleConv. .. rubric:: Hugging Face Hub integration When the optional ``huggingface_hub`` package is installed, all models automatically gain the ability to be pushed to and loaded from the Hugging Face Hub. Install with:: pip install braindecode[hub] **Pushing a model to the Hub:** .. code:: from braindecode.models import EEGSimpleConv # Train your model model = EEGSimpleConv(n_chans=22, n_outputs=4, n_times=1000) # ... training code ... # Push to the Hub model.push_to_hub( repo_id="username/my-eegsimpleconv-model", commit_message="Initial model upload", ) **Loading a model from the Hub:** .. code:: from braindecode.models import EEGSimpleConv # Load pretrained model model = EEGSimpleConv.from_pretrained("username/my-eegsimpleconv-model") # Load with a different number of outputs (head is rebuilt automatically) model = EEGSimpleConv.from_pretrained("username/my-eegsimpleconv-model", n_outputs=4) **Extracting features and replacing the head:** .. code:: import torch x = torch.randn(1, model.n_chans, model.n_times) # Extract encoder features (consistent dict across all models) out = model(x, return_features=True) features = out["features"] # Replace the classification head model.reset_head(n_outputs=10) **Saving and restoring full configuration:** .. code:: import json config = model.get_config() # all __init__ params with open("config.json", "w") as f: json.dump(config, f) model2 = EEGSimpleConv.from_config(config) # reconstruct (no weights) All model parameters (both EEG-specific and model-specific such as dropout rates, activation functions, number of filters) are automatically saved to the Hub and restored when loading. See :ref:`load-pretrained-models` for a complete tutorial.
## Citation Please cite both the original paper for this architecture (see the *References* section 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.