TimmEncoderFixed¶
- class TimmEncoderFixed(name, in_channels=3, depth=5, output_stride=32, drop_rate=0.5, drop_path_rate=0.0, *, pretrained=True)[source]¶
Fixed version of TIMM encoder that handles drop_path_rate parameter properly.
This encoder wraps TIMM models to provide consistent feature extraction interface for segmentation tasks. It extracts features at multiple scales from the encoder backbone.
Initialize TimmEncoderFixed.
- Parameters:
name (str) – Name of the TIMM model to use as backbone.
in_channels (int) – Number of input channels. Default is 3.
depth (int) – Number of encoder stages to extract features from. Default is 5.
output_stride (int) – Output stride of the encoder. Default is 32.
drop_rate (float) – Dropout rate. Default is 0.5.
drop_path_rate (float | None) – Drop path rate of the encoder. Default is 0.0.
pretrained (bool) – Whether to use pretrained weights. Default is True.
Methods
Forward pass through the encoder.
Attributes
Get output channels for each feature level.
Get the output stride of the encoder.
training- forward(x)[source]¶
Forward pass through the encoder.
- Parameters:
x (torch.Tensor) – Input tensor of shape (B, C, H, W)
- Returns:
List of feature tensors at different scales, including the input as the first element
- Return type: