braindecode.models.EEGNetv4#
- class braindecode.models.EEGNetv4(n_chans: int | None = None, n_outputs: int | None = None, n_times: int | None = None, final_conv_length: str | int = 'auto', pool_mode: str = 'mean', F1: int = 8, D: int = 2, F2: int | None = None, kernel_length: int = 64, *, depthwise_kernel_length: int = 16, pool1_kernel_size: int = 4, pool1_stride_size: int = 4, pool2_kernel_size: int = 8, pool2_stride_size: int = 8, conv_spatial_max_norm: int = 1, activation: ~torch.nn.modules.module.Module = <class 'torch.nn.modules.activation.ELU'>, batch_norm_momentum: float = 0.01, batch_norm_affine: bool = True, batch_norm_eps: float = 0.001, drop_prob: float = 0.25, chs_info: ~typing.List[~typing.Dict] | None = None, input_window_seconds: float | None = None, sfreq: float | None = None, **kwargs)[source]#
EEGNet v4 model from Lawhern et al. (2018) [EEGNet4].
See details in [EEGNet4].
- 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.
final_conv_length (int or "auto", default="auto") – Length of the final convolution layer. If “auto”, it is set based on the n_times.
pool_mode (str, {"mean", "max"}, default="mean") – Pooling method to use in pooling layers.
F1 (int, default=8) – Number of temporal filters in the first convolutional layer.
D (int, default=2) – Depth multiplier for the depthwise convolution.
F2 (int or None, default=None) – Number of pointwise filters in the separable convolution. Usually set to
F1 * D
.kernel_length (int, default=64) – Length of the temporal convolution kernel.
depthwise_kernel_length (int, default=16) – Length of the depthwise convolution kernel in the separable convolution.
pool1_kernel_size (int, default=4) – Kernel size of the first pooling layer.
pool1_stride_size (int, default=4) – Stride size of the first pooling layer.
pool2_kernel_size (int, default=8) – Kernel size of the second pooling layer.
pool2_stride_size (int, default=8) – Stride size of the second pooling layer.
conv_spatial_max_norm (float, default=1) – Max norm constraint for the spatial convolution layer.
activation (nn.Module, default=nn.ELU) – Activation function to apply. Should be a PyTorch activation module like
nn.ReLU
ornn.ELU
after the batch normalization layer.batch_norm_momentum (float, default=0.01) – Momentum for the batch normalization layers.
batch_norm_affine (bool, default=True) – Whether to include learnable affine parameters in batch normalization layers.
batch_norm_eps (float, default=1e-3) – Epsilon value for batch normalization layers.
drop_prob (float, default=0.25) – Dropout probability after the second conv block and before the last layer.
chs_info (list of dict) – Information about each individual EEG channel. This should be filled with
info["chs"]
. Refer tomne.Info
for more details.input_window_seconds (float) – Length of the input window in seconds.
sfreq (float) – Sampling frequency of the EEG recordings.
**kwargs – The description is missing.
- 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 description.
References