RegNet#
- class torch_ecg.models.RegNet(in_channels: int, **config)[source]#
Bases:
Sequential,SizeMixin,CitationMixinRegNet model.
RegNet is a family of convolutional neural networks that can be constructed by efficiently scaling and pruning a single convolutional “stem” network. This architecture is proposed in [1], and the implementation is adapted from [2].
References
- Parameters:
in_channels (int) – Number of channels of the input.
config (dict) –
Hyper-parameters of the Module, ref. corr. config file. Keyword arguments that must be set:
filter_lengths: int or sequence of int, filter length(s) (kernel size(s)) of the convolutions, with granularity to the whole network, to each stage.
subsample_lengths: int or sequence of int, subsampling length(s) (ratio(s)) of all blocks, with granularity to the whole network, to each stage.
tot_blocks: int, the total number of building blocks.
w_a, w_0, w_m: float, the parameters for the widths generating function.
group_widths: int or sequence of int, the number of channels in each group, with granularity to the whole network, to each stage.
num_blocks: sequence of int, optional, the number of blocks in each stage, if not given, will be computed from tot_blocks and w_a, w_0, w_m.
num_filters: int or sequence of int, optional, the number of filters in each stage. If not given, will be computed from tot_blocks and w_a, w_0, w_m.
stem: dict, the config of the input stem.
block: dict, other parameters that can be set for the building blocks.
- 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.
- compute_output_shape(seq_len: int | None = None, batch_size: int | None = None) Sequence[int | None][source]#
Compute the output shape of the network.
- 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: