EEGConformer#
- class dpeeg.models.EEGConformer.EEGConformer(nCh: int, nTime: int, nCls: int, emb_size: int = 40, depth: int = 6, num_heads: int = 10, drop_p: float = 0.5, forward_expansion: int = 4, forward_drop_p: float = 0.5)[source]#
EEG Conformer: Convolutional Transformer for EEG Decoding and Visualization (EEG Conformer).
EEG Conformer [1] is proposed to encapsulate local and global features in a unified EEG classification framework. The architecture comprises three components: a convolution module, a self-attention module, and a fully- connected classifier. In the convolution module, taking the raw two- dimensional EEG trials as the input, temporal and spatial convolutional layers are applied along the time dimension and electrode channel dimensions, respectively. Then, an average pooling layer is utilized to suppress noise interference while improving generalization. Secondly, the spatial-temporal representation obtained by the convolution module is fed into the selfattention module. The self-attention module further extracts the long-term temporal features by measuring the global correlations between different time positions in the feature maps. Finally, a compact classifier consisting of several fullyconnected layers is adopted to output the decoding results.
- 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.
emb_size (int) – Embedding layer size.
depth (int) – Depth of transformer encoder.
num_heads (int) – Number of multi-head attention.
drop_p (float) – Dropout rate of transformer encoder.
forward_expansion (int) – The expansion factor of the fully connected feed-forward layer.
forward_drop_p (float) – Dropout rate of fully connected feed-forward layer.
References