Decoders
terratorch.models.decoders.fcn_decoder
#
FCNDecoder
#
Bases: Module
Fully Convolutional Decoder
__init__(embed_dim, channels=256, num_convs=4, in_index=-1)
#
Constructor
Parameters:
Name | Type | Description | Default |
---|---|---|---|
embed_dim
|
_type_
|
Input embedding dimension |
required |
channels
|
int
|
Number of channels for each conv. Defaults to 256. |
256
|
num_convs
|
int
|
Number of convs. Defaults to 4. |
4
|
in_index
|
int
|
Index of the input list to take. Defaults to -1. |
-1
|
terratorch.models.decoders.identity_decoder
#
Pass the features straight through
IdentityDecoder
#
Bases: Module
Identity decoder. Useful to pass the feature straight to the head.
__init__(embed_dim, out_index=-1)
#
Constructor
Parameters:
Name | Type | Description | Default |
---|---|---|---|
embed_dim
|
int
|
Input embedding dimension |
required |
out_index
|
int
|
Index of the input list to take.. Defaults to -1. |
-1
|
terratorch.models.decoders.upernet_decoder
#
PPM
#
Bases: ModuleList
Pooling Pyramid Module used in PSPNet.
__init__(pool_scales, in_channels, channels, align_corners)
#
Constructor
Parameters:
Name | Type | Description | Default |
---|---|---|---|
pool_scales
|
tuple[int]
|
Pooling scales used in Pooling Pyramid Module. |
required |
in_channels
|
int
|
Input channels. |
required |
channels
|
int
|
Channels after modules, before conv_seg. |
required |
align_corners
|
bool
|
align_corners argument of F.interpolate. |
required |
forward(x)
#
Forward function.
UperNetDecoder
#
Bases: Module
UperNetDecoder. Adapted from MMSegmentation.
__init__(embed_dim, pool_scales=(1, 2, 3, 6), channels=256, align_corners=True, scale_modules=False)
#
Constructor
Parameters:
Name | Type | Description | Default |
---|---|---|---|
embed_dim
|
list[int]
|
Input embedding dimension for each input. |
required |
pool_scales
|
tuple[int]
|
Pooling scales used in Pooling Pyramid Module applied on the last feature. Default: (1, 2, 3, 6). |
(1, 2, 3, 6)
|
channels
|
int
|
Channels used in the decoder. Defaults to 256. |
256
|
align_corners
|
bool
|
Wheter to align corners in rescaling. Defaults to True. |
True
|
scale_modules
|
bool
|
Whether to apply scale modules to the inputs. Needed for plain ViT. Defaults to False. |
False
|
forward(inputs)
#
Forward function for feature maps before classifying each pixel with Args: inputs (list[Tensor]): List of multi-level img features.
Returns:
Name | Type | Description |
---|---|---|
feats |
Tensor
|
A tensor of shape (batch_size, self.channels, H, W) which is feature map for last layer of decoder head. |
psp_forward(inputs)
#
Forward function of PSP module.