braindecode.models.EEGInceptionERP#

class braindecode.models.EEGInceptionERP(n_chans=None, n_outputs=None, n_times=1000, sfreq=128, drop_prob=0.5, scales_samples_s=(0.5, 0.25, 0.125), n_filters=8, activation=ELU(alpha=1.0), batch_norm_alpha=0.01, depth_multiplier=2, pooling_sizes=(4, 2, 2, 2), chs_info=None, input_window_seconds=None, in_channels=None, n_classes=None, input_window_samples=None, add_log_softmax=True)[source]#

EEG Inception for ERP-based classification

The code for the paper and this model is also available at [Santamaria2020] and an adaptation for PyTorch [2].

The model is strongly based on the original InceptionNet for an image. The main goal is to extract features in parallel with different scales. The authors extracted three scales proportional to the window sample size. The network had three parts: 1-larger inception block largest, 2-smaller inception block followed by 3-bottleneck for classification.

One advantage of the EEG-Inception block is that it allows a network to learn simultaneous components of low and high frequency associated with the signal. The winners of BEETL Competition/NeurIps 2021 used parts of the model [R37c4761d4e92-beetl].

The model is fully described in [Santamaria2020].

Parameters:
  • n_chans (int) – Number of EEG channels.

  • n_outputs (int) – Number of outputs of the model. This is the number of classes in the case of classification.

  • n_times (int, optional) – Size of the input, in number of samples. Set to 128 (1s) as in [Santamaria2020].

  • sfreq (float, optional) – EEG sampling frequency. Defaults to 128 as in [Santamaria2020].

  • drop_prob (float, optional) – Dropout rate inside all the network. Defaults to 0.5 as in [Santamaria2020].

  • scales_samples_s (list(float), optional) – Windows for inception block. Temporal scale (s) of the convolutions on each Inception module. This parameter determines the kernel sizes of the filters. Defaults to 0.5, 0.25, 0.125 seconds, as in [Santamaria2020].

  • n_filters (int, optional) – Initial number of convolutional filters. Defaults to 8 as in [Santamaria2020].

  • activation (nn.Module, optional) – Activation function. Defaults to ELU activation as in [Santamaria2020].

  • batch_norm_alpha (float, optional) – Momentum for BatchNorm2d. Defaults to 0.01.

  • depth_multiplier (int, optional) – Depth multiplier for the depthwise convolution. Defaults to 2 as in [Santamaria2020].

  • pooling_sizes (list(int), optional) – Pooling sizes for the inception blocks. Defaults to 4, 2, 2 and 2, as in [Santamaria2020].

  • chs_info (list of dict) – Information about each individual EEG channel. This should be filled with info["chs"]. Refer to mne.Info for more details.

  • input_window_seconds (float) – Length of the input window in seconds.

  • in_channels (int) – Alias for n_chans.

  • n_classes (int) – Alias for n_outputs.

  • input_window_samples (int) – Alias for n_times.

  • add_log_softmax (bool) – Whether to use log-softmax non-linearity as the output function. LogSoftmax final layer will be removed in the future. Please adjust your loss function accordingly (e.g. CrossEntropyLoss)! Check the documentation of the torch.nn loss functions: https://pytorch.org/docs/stable/nn.html#loss-functions.

Raises:
  • ValueError – If some input signal-related parameters are not specified: and can not be inferred.

  • FutureWarning – If add_log_softmax is True, since LogSoftmax final layer: will be removed in the future.

Notes

This implementation is not guaranteed to be correct, has not been checked by original authors, only reimplemented from the paper based on [2].

References

[Santamaria2020] (1,2,3,4,5,6,7,8,9,10)

Santamaria-Vazquez, E., Martinez-Cagigal, V., Vaquerizo-Villar, F., & Hornero, R. (2020). EEG-inception: A novel deep convolutional neural network for assistive ERP-based brain-computer interfaces. IEEE Transactions on Neural Systems and Rehabilitation Engineering , v. 28. Online: http://dx.doi.org/10.1109/TNSRE.2020.3048106

[2] (1,2)

Grifcc. Implementation of the EEGInception in torch (2022). Online: Grifcc/EEG