MobileNetV1

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

Bases: Sequential, SizeMixin, CitationMixin

MobileNet V1.

Similar to Xception, but without skip connections. Separable convolutions are slightly different too.

normal conv –> entry flow (separable convs, down sample and double channels every other conv) –> middle flow (separable convs, no down sampling, stationary number of channels) –> exit flow (separable convs, down sample and double channels at each conv).

MobileNet V1 is a light-weight model intended for mobile devices, originally proposed in [1].

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

  • config (dict) –

    Other hyper-parameters of the Module, ref. corresponding config file. key word arguments that have to be set in 3 sub-dict, namely in “entry_flow”, “middle_flow”, and “exit_flow”, including

    • out_channels: int, number of channels of the output.

    • kernel_size: int, kernel size of down sampling. If not specified, defaults to down_scale.

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

    • padding: int, zero-padding added to both sides of the input.

    • batch_norm: bool or Module, batch normalization, the Module itself or (if is bool) whether or not to use torch.nn.BatchNorm1d.

References

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

Compute the output shape of the model.

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

  • batch_size (int, optional,) – The batch size of the input tensor.

Returns:

output_shape – Output shape of the model.

Return type:

sequence