Meta models
terratorch.models.pixel_wise_model.PixelWiseModel
#
Bases: Model
, SegmentationModel
Model that encapsulates encoder and decoder and heads Expects decoder to have a "forward_features" method, an embed_dims property and optionally a "prepare_features_for_image_model" method.
Source code in terratorch/models/pixel_wise_model.py
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 |
|
__init__(task, encoder, decoder, head_kwargs, patch_size=None, padding=None, decoder_includes_head=False, auxiliary_heads=None, neck=None, rescale=True)
#
Constructor
Parameters:
Name | Type | Description | Default |
---|---|---|---|
task
|
str
|
Task to be performed. One of segmentation or regression. |
required |
encoder
|
Module
|
Encoder to be used |
required |
decoder
|
Module
|
Decoder to be used |
required |
head_kwargs
|
dict
|
Arguments to be passed at instantiation of the head. |
required |
decoder_includes_head
|
bool
|
Whether the decoder already incldes a head. If true, a head will not be added. Defaults to False. |
False
|
auxiliary_heads
|
list[AuxiliaryHeadWithDecoderWithoutInstantiatedHead] | None
|
List of AuxiliaryHeads with heads to be instantiated. Defaults to None. |
None
|
neck
|
Module | None
|
Module applied between backbone and decoder. Defaults to None, which applies the identity. |
None
|
rescale
|
bool
|
Rescale the output of the model if it has a different size than the ground truth. Uses bilinear interpolation. Defaults to True. |
True
|
Source code in terratorch/models/pixel_wise_model.py
forward(x, **kwargs)
#
Sequentially pass x
through model`s encoder, decoder and heads
Source code in terratorch/models/pixel_wise_model.py
terratorch.models.scalar_output_model.ScalarOutputModel
#
Bases: Model
, SegmentationModel
Model that encapsulates encoder and decoder and heads for a scalar output Expects decoder to have a "forward_features" method, an embed_dims property and optionally a "prepare_features_for_image_model" method.
Source code in terratorch/models/scalar_output_model.py
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 |
|
__init__(task, encoder, decoder, head_kwargs, patch_size=None, padding=None, decoder_includes_head=False, auxiliary_heads=None, neck=None)
#
Constructor
Parameters:
Name | Type | Description | Default |
---|---|---|---|
task
|
str
|
Task to be performed. Must be "classification". |
required |
encoder
|
Module
|
Encoder to be used |
required |
decoder
|
Module
|
Decoder to be used |
required |
head_kwargs
|
dict
|
Arguments to be passed at instantiation of the head. |
required |
decoder_includes_head
|
bool
|
Whether the decoder already incldes a head. If true, a head will not be added. Defaults to False. |
False
|
auxiliary_heads
|
list[AuxiliaryHeadWithDecoderWithoutInstantiatedHead] | None
|
List of AuxiliaryHeads with heads to be instantiated. Defaults to None. |
None
|
neck
|
Module | None
|
Module applied between backbone and decoder. Defaults to None, which applies the identity. |
None
|
Source code in terratorch/models/scalar_output_model.py
forward(x, **kwargs)
#
Sequentially pass x
through model`s encoder, decoder and heads