rslearn.train.transforms.adaptive_pooling¶
adaptive_pooling ¶
Adaptive pooling transform.
AdaptivePooling ¶
Bases: Transform
Pools inputs to a target size using adaptive spatial pooling.
Supports max pooling and mean pooling over each spatial region. Mean pooling returns floating-point outputs for non-floating inputs so the averages are preserved.
Source code in rslearn/train/transforms/adaptive_pooling.py
apply_pooling ¶
apply_pooling(image: RasterImage) -> RasterImage
Apply adaptive spatial pooling on the specified image.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
image
|
RasterImage
|
the image to transform (CTHW tensor). |
required |
Returns:
| Type | Description |
|---|---|
RasterImage
|
the pooled image. |
Source code in rslearn/train/transforms/adaptive_pooling.py
forward ¶
forward(input_dict: dict[str, Any], target_dict: dict[str, Any]) -> tuple[dict[str, Any], dict[str, Any]]
Apply transform over the inputs and targets.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
input_dict
|
dict[str, Any]
|
the input |
required |
target_dict
|
dict[str, Any]
|
the target |
required |
Returns:
| Type | Description |
|---|---|
tuple[dict[str, Any], dict[str, Any]]
|
transformed (input_dicts, target_dicts) tuple |