Timm

class mmit.encoders.TimmEncoder(name, pretrained=True, in_chans=3, out_indices=(0, 1, 2, 3, 4), output_stride=32, **kwargs)

Wrapper for timm encoders.

Parameters:
  • name (str) – The name of the timm encoder.

  • pretrained (bool) – If True, returns a model pre-trained on ImageNet.

  • in_chans (int) – The number of input channels.

  • out_indices (tuple) – The indices of the layers to return.

  • output_stride (int) – The output stride of the encoder.

forward(x)

Forward pass of the encoder

Parameters:

x – Input tensor of shape (B, C, H, W)

Returns:

A list of tensors of shape (B, C, H // fi, W // fi) with the features. The first element is the input tensor, fi is the reduction factor of the i-th feature.

property out_channels

Number of channels of the output tensors

property out_reductions

Reduction factor of the output tensors