VGG16#

class torch_ecg.models.VGG16(in_channels: int, **config)[source]#

Bases: Sequential, SizeMixin, CitationMixin

CNN feature extractor of VGG architecture.

Parameters:
  • in_channels (int) – Number of channels in the input.

  • config (dict) –

    Other hyper-parameters of the Module, including number of convolutional layers, number of filters for each layer, and more for VGGBlock. Key word arguments that have to be set:

    • num_convs: sequence of int, number of convolutional layers for each VGGBlock.

    • num_filters: sequence of int, number of filters for each VGGBlock.

    • groups: int, connection pattern (of channels) of the inputs and outputs.

    • block: dict, other parameters that can be set for VGGBlock.

    For a full list of configurable parameters, ref. corr. config file.

compute_features_output_shape(seq_len: int | None = None, batch_size: int | None = None) Sequence[int | None][source]#

Compute the output shape of the features.

Parameters:
  • seq_len (int, optional) – Length of the input signal tensor.

  • batch_size (int, optional) – Batch size of the input signal tensor.

Returns:

output_shape – Output shape of the features.

Return type:

sequence

compute_output_shape(seq_len: int | None = None, batch_size: int | None = None) Sequence[int | None][source]#

Compute the output shape of the module.

Parameters:
  • seq_len (int, optional) – Length of the input tensors.

  • batch_size (int, optional) – Batch size of the input tensors.

Returns:

output_shape – The output shape of the module.

Return type:

sequence

forward_features(input: Tensor) Tensor[source]#

Forward pass of the model to extract features.

Parameters:

input (torch.Tensor) – Input signal tensor, of shape (batch_size, channels, seq_len).

Returns:

features – Feature map tensor, of shape (batch_size, channels, seq_len).

Return type:

torch.Tensor