EEGNet#

class dpeeg.models.EEGNet.EEGNet(nCh: int, nTime: int, nCls: int, F1: int = 8, C1: int = 63, D: int = 2, F2: int = 16, C2: int = 15, P1: int = 8, P2: int = 16, dropout: float = 0.5)[source]#

EEGNet: A Compact Convolutional Neural Network for EEG-based Brain-Computer Interfaces (EEGNet).

EEGNet [1] is a compact convolutional neural network for EEG-based BCIs. EEGNet starts with a temporal convolution to learn frequency filters, then uses a depthwise convolution, connected to each feature map individually, to learn frequency-specific spatial filters. The separable convolution is a combination of a depthwise convolution, which learns a temporal summary for each feature map individually, followed by a pointwise convolution, which learns how to optimally mix the feature maps together.

Parameters:
  • nCh (int) – Number of electrode channels.

  • nTime (int) – Number of data sampling points. For example, a 4-second data input with a sampling rate of 250 Hz is 1000.

  • nCls (int) – Number of classification categories.

  • F1 (int) – Number of temporal filters.

  • C1 (int) – Temporal convolution kernel size.

  • D (int) – Depth of depthwise convolution.

  • F2 (int) – Number of separable convolutions.

  • C2 (int) – Separable convolution kernel size.

  • P1 (int) – The first pooling kernel size.

  • P2 (int) – The second pooling kernel size.

  • dropout (float) – Dropout rate.

References

forward(x)[source]#

Forward pass function that processes the input EEG data and produces the decoded results.

Parameters:

x (Tensor) – Input EEG data, shape (batch_size, 1, nCh, nTime).

Returns:

cls_prob – Predicted class probability, shape (batch_size, nCls).

Return type:

Tensor