braindecode.models.EEGInception#

class braindecode.models.EEGInception(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

–> DEPRECATED <– THIS CLASS IS DEPRECATED AND WILL BE REMOVED IN THE RELEASE 0.9 OF BRAINDECODE. PLEASE USE braindecode.models.EEGInceptionERP INSTEAD IN THE FUTURE.

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 [R15fdf33b022f-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) – Number of time samples of the input window.

  • sfreq (float) – Sampling frequency of the EEG recordings.

  • drop_prob (float) – Dropout rate inside all the network.

  • scales_samples_s – The description is missing.

  • n_filters (int) – Initial number of convolutional filters. Set to 8 in [Santamaria2020].

  • activation (nn.Module) – Activation function, default: ELU activation.

  • batch_norm_alpha (float) – Momentum for BatchNorm2d.

  • depth_multiplier (int) – Depth multiplier for the depthwise convolution.

  • pooling_sizes (list(int)) – Pooling sizes for the inception block.

  • 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 input_window_seconds.

  • 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)

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