rslearn.models.pooling_decoder¶
pooling_decoder ¶
Simple pooling decoder.
PoolingDecoder ¶
Bases: IntermediateComponent
Decoder that computes flat vector from a 2D feature map.
It inputs multi-scale features, but only uses the last feature map. Then applies a configurable number of convolutional layers before pooling, and a configurable number of fully connected layers after pooling.
For patch-level regression from a spatial backbone (e.g. OlmoEarth), set out_channels=1 to produce a Bx1 FeatureVector that feeds directly into RegressionHead without any additional projection step.
Source code in rslearn/models/pooling_decoder.py
forward ¶
forward(intermediates: Any, context: ModelContext) -> Any
Compute flat output vector from multi-scale feature map.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
intermediates
|
Any
|
the output from the previous component, which must be a FeatureMaps. |
required |
context
|
ModelContext
|
the model context. |
required |
Returns:
| Type | Description |
|---|---|
Any
|
flat feature vector |
Source code in rslearn/models/pooling_decoder.py
SegmentationPoolingDecoder ¶
Bases: PoolingDecoder
Like PoolingDecoder, but copy output to all pixels.
This allows for the model to produce a global output while still being compatible with SegmentationTask. This only makes sense for very small windows, since the output probabilities will be the same at all pixels. The main use case is to train for a classification-like task on small windows, but still produce a raster during inference on large windows.
Source code in rslearn/models/pooling_decoder.py
forward ¶
forward(intermediates: Any, context: ModelContext) -> Any
Extend PoolingDecoder forward to upsample the output to a segmentation mask.
This only works when all of the pixels have the same segmentation target.