qumphy.models.inception1d module
File: qumphy/models/inception1d.py Project: 22HLT01 QUMPHY Contact: oskar.pfeffer@ptb.de Gitlab: https://gitlab.com/qumphy Description: InceptionTime-based 1D convolutional neural network.
- class qumphy.models.inception1d.Inception1d(*args: Any, **kwargs: Any)[source]
Bases:
Moduleinception time architecture
- forward(x)[source]
Run a forward pass through the model.
- Parameters:
x (torch.Tensor) – Input tensor of shape (batch_size, input_channels, sequence_length).
- Returns:
Model output tensor of shape (batch_size, num_classes).
- Return type:
torch.Tensor
- get_layer_groups()[source]
Get grouped layers for model training.
- Returns:
Layer groups containing part of the backbone and the model head. If the depth is less than or equal to 3, only the model head is returned.
- Return type:
tuple or nn.Module
- class qumphy.models.inception1d.InceptionBackbone(*args: Any, **kwargs: Any)[source]
Bases:
ModuleBackbone of the 1D Inception architecture.
The backbone stacks multiple Inception blocks and optionally applies residual shortcut connections every three blocks.
- class qumphy.models.inception1d.InceptionBlock1d(*args: Any, **kwargs: Any)[source]
Bases:
ModuleOne-dimensional Inception block.
The block applies several convolutions with different kernel sizes and concatenates their outputs with a max-pooling branch. :param ni: Number of input channels. :type ni: int :param nb_filters: Number of filters used in each convolution branch. :type nb_filters: int :param kss: List of kernel sizes used by the convolution branches. :type kss: list :param stride: Stride used in the bottleneck and pooling branches. :type stride: int :param act: Activation function name. This parameter is currently not used. :type act: str :param bottleneck_size: Number of filters used in the bottleneck convolution. If 0, no
bottleneck convolution is applied.
- class qumphy.models.inception1d.Shortcut1d(*args: Any, **kwargs: Any)[source]
Bases:
ModuleResidual shortcut connection for 1D convolutional features.
- forward(inp, out)[source]
Apply the residual shortcut connection.
- Parameters:
inp (torch.Tensor) – Input tensor used for the shortcut branch.
out (torch.Tensor) – Output tensor from the main branch.
- Returns:
Result of adding the shortcut branch to the main branch and applying ReLU activation.
- Return type:
torch.Tensor
- qumphy.models.inception1d.conv(in_planes, out_planes, kernel_size=3, stride=1)[source]
Create a 1D convolutional layer with padding.
- Parameters:
in_planes (int) – Number of input channels.
out_planes (int) – Number of output channels.
kernel_size (int) – Size of the convolution kernel.
stride (int) – Stride of the convolution.
- Returns:
One-dimensional convolutional layer.
- Return type:
nn.Conv1d