DeepConvNetEncoder
- class selfeeg.models.encoders.DeepConvNetEncoder(Chans: int, kernLength: int = 10, F: int = 25, Pool: int = 3, stride: int = 3, max_norm: float = None, batch_momentum: float = 0.1, ELUalpha: int = 1, dropRate: float = 0.5, seed: int = None)[source]
Pytorch Implementation of the DeepConvNet Encoder.
See DeepConvNet for some references. The expected input is a 3D tensor with size (Batch x Channels x Samples).
- Parameters:
Chans (int) – The number of EEG channels.
kernlength (int, optional) –
The length of the temporal convolutional layer.
Default = 10
F (int, optional) –
The number of filters in the first layer. Next layers will continue to double the previous output feature size.
Default = 25
Pool (int, optional) –
The temporal pooling kernel size.
Default = 3
stride (int, optional) –
The stride to apply to the convolutional layers.
Default = 3
max_norm (int, optional) –
A max norm constraint to apply to each filter of the convolutional layer. See
ConstrainedConv2dfor more info.Default = None
batch_momentum (float, optional) –
The batch normalization momentum.
Default = 0.1
ELUalpha (float, optional) –
The alpha value of the ELU activation function.
Default = 1
dropRate (float, optional) –
The dropout percentage in range [0,1].
Default = 0.5
seed (int, optional) –
A custom seed for model initialization. It must be a nonnegative number. If None is passed, no custom seed will be set
Default = None
Example
>>> import selfeeg.models >>> import torch >>> x = torch.randn(4,8,512) >>> mdl = models.DeepConvNetEncoder(8) >>> out = mdl(x) >>> print(out.shape) # shoud return torch.Size([4, 200]) >>> print(torch.isnan(out).sum()) # shoud return 0