braindecode.models.SPARCNet#
- class braindecode.models.SPARCNet(n_chans=None, n_times=None, n_outputs=None, block_layers=4, growth_rate=16, bottleneck_size=16, drop_prob=0.5, conv_bias=True, batch_norm=True, activation=<class 'torch.nn.modules.activation.ELU'>, kernel_size_conv0=7, kernel_size_conv1=1, kernel_size_conv2=3, kernel_size_pool=3, stride_pool=2, stride_conv0=2, stride_conv1=1, stride_conv2=1, padding_pool=1, padding_conv0=3, padding_conv2=1, kernel_size_trans=2, stride_trans=2, chs_info=None, input_window_seconds=None, sfreq=None)[source]#
Seizures, Periodic and Rhythmic pattern Continuum Neural Network (SPaRCNet) from Jing et al. (2023) [jing2023].
Convolution
This is a temporal CNN model for biosignal classification based on the DenseNet architecture.
The model is based on the unofficial implementation [Code2023].
Added in version 0.9.
- Parameters:
n_chans (int) – Number of EEG channels.
n_times (int) – Number of time samples of the input window.
n_outputs (int) – Number of outputs of the model. This is the number of classes in the case of classification.
block_layers (int, optional) – Number of layers per dense block. Default is 4.
growth_rate (int, optional) – Growth rate of the DenseNet. Default is 16.
bottleneck_size (
int
) – The description is missing.drop_prob (float, optional) – Dropout rate. Default is 0.5.
conv_bias (bool, optional) – Whether to use bias in convolutional layers. Default is True.
batch_norm (bool, optional) – Whether to use batch normalization. Default is True.
activation (nn.Module, default=nn.ELU) – Activation function class to apply. Should be a PyTorch activation module class like
nn.ReLU
ornn.ELU
. Default isnn.ELU
.kernel_size_conv0 (
int
) – The description is missing.kernel_size_conv1 (
int
) – The description is missing.kernel_size_conv2 (
int
) – The description is missing.kernel_size_pool (
int
) – The description is missing.stride_pool (
int
) – The description is missing.stride_conv0 (
int
) – The description is missing.stride_conv1 (
int
) – The description is missing.stride_conv2 (
int
) – The description is missing.padding_pool (
int
) – The description is missing.padding_conv0 (
int
) – The description is missing.padding_conv2 (
int
) – The description is missing.kernel_size_trans (
int
) – The description is missing.stride_trans (
int
) – The description is missing.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.
- Raises:
ValueError – If some input signal-related parameters are not specified: and can not be inferred.
Notes
This implementation is not guaranteed to be correct, has not been checked by original authors.
References
[jing2023]Jing, J., Ge, W., Hong, S., Fernandes, M. B., Lin, Z., Yang, C., … & Westover, M. B. (2023). Development of expert-level classification of seizures and rhythmic and periodic patterns during eeg interpretation. Neurology, 100(17), e1750-e1762.
[Code2023]Yang, C., Westover, M.B. and Sun, J., 2023. BIOT Biosignal Transformer for Cross-data Learning in the Wild. GitHub ycq091044/BIOT (accessed 2024-02-13)
Methods
- forward(X)[source]#
Forward pass of the model.
- Parameters:
X (torch.Tensor) – The input tensor of the model with shape (batch_size, n_channels, n_times)
- Returns:
The output tensor of the model with shape (batch_size, n_outputs)
- Return type: