braindecode.models.TSceptionV1#
- class braindecode.models.TSceptionV1(n_chans=None, n_outputs=None, input_window_seconds=None, chs_info=None, n_times=None, sfreq=None, number_filter_temp: int = 9, number_filter_spat: int = 6, hidden_size: int = 128, drop_prob: float = 0.5, activation: ~torch.nn.modules.module.Module = <class 'torch.nn.modules.activation.LeakyReLU'>, pool_size: int = 8, inception_windows: ~typing.Tuple[float, float, float] = (0.5, 0.25, 0.125))[source]#
TSception model from Ding et al. (2020) from [ding2020].
TSception: A deep learning framework for emotion detection using EEG.
The model consists of temporal and spatial convolutional layers (Tception and Sception) designed to learn temporal and spatial features from EEG data.
- 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.
input_window_seconds (float) – Length of the input window in seconds.
chs_info (list of dict) – Information about each individual EEG channel. This should be filled with
info["chs"]
. Refer tomne.Info
for more details.n_times (int) – Number of time samples of the input window.
sfreq (float) – Sampling frequency of the EEG recordings.
number_filter_temp (int) – Number of temporal convolutional filters.
number_filter_spat (int) – Number of spatial convolutional filters.
hidden_size (int) – Number of units in the hidden fully connected layer.
drop_prob (float) – Dropout rate applied after the hidden layer.
activation (nn.Module, optional) – Activation function class to apply. Should be a PyTorch activation module like
nn.ReLU
ornn.LeakyReLU
. Default isnn.LeakyReLU
.pool_size (int, optional) – Pooling size for the average pooling layers. Default is 8.
inception_windows (List[float], optional) – List of window sizes (in seconds) for the inception modules. Default is [0.5, 0.25, 0.125].
- 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. The modifications are minimal and the model is expected to work as intended. the original code from [code2020].
References
[ding2020]Ding, Y., Robinson, N., Zeng, Q., Chen, D., Wai, A. A. P., Lee, T. S., & Guan, C. (2020, July). Tsception: a deep learning framework for emotion detection using EEG. In 2020 international joint conference on neural networks (IJCNN) (pp. 1-7). IEEE.
[code2020]Ding, Y., Robinson, N., Zeng, Q., Chen, D., Wai, A. A. P., Lee, T. S., & Guan, C. (2020, July). Tsception: a deep learning framework for emotion detection using EEG. deepBrains/TSception
Methods
- forward(x: Tensor) Tensor [source]#
Forward pass of the TSception model.
- Parameters:
x (torch.Tensor) – Input tensor of shape (batch_size, n_channels, n_times).
- Returns:
Output tensor of shape (batch_size, n_classes).
- Return type: