Skip to content

Commit

Permalink
minor fix for unet, and reg_upernet
Browse files Browse the repository at this point in the history
  • Loading branch information
yurujaja committed Oct 15, 2024
1 parent 5c2fd24 commit 210a5bc
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
11 changes: 9 additions & 2 deletions pangaea/decoders/upernet.py
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,12 @@ class RegUPerNet(Decoder):
"""

def __init__(
self, encoder: Encoder, finetune: bool, channels: int, pool_scales=(1, 2, 3, 6)
self,
encoder: Encoder,
finetune: bool,
channels: int,
pool_scales=(1, 2, 3, 6),
feature_multiplier: int = 1,
):
super().__init__(
encoder=encoder,
Expand Down Expand Up @@ -644,14 +649,16 @@ def __init__(
multi_temporal: bool | int,
multi_temporal_strategy: str | None,
pool_scales=(1, 2, 3, 6),
feature_multiplier: int = 1,
):
super().__init__(
encoder=encoder,
finetune=finetune,
channels=channels,
pool_scales=pool_scales,
feature_multiplier=feature_multiplier,
)

self.model_name = "Reg_MT_UPerNet"
self.multi_temporal = multi_temporal
self.multi_temporal_strategy = multi_temporal_strategy

Expand Down
6 changes: 3 additions & 3 deletions pangaea/encoders/unet_encoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,15 @@ def __init__(
input_bands=input_bands,
input_size=input_size,
embed_dim=0,
output_dim=0,
output_layers=output_layers,
output_dim=output_dim,
output_layers=None,
multi_temporal=False, # single time frame
multi_temporal_output=False,
pyramid_output=True,
download_url=download_url,
)

# TODO: now only supports optical bands for single time frame
self.in_channels = len(input_bands["optical"]) # number of optical bands
self.topology = topology

Expand Down Expand Up @@ -91,7 +92,6 @@ def __init__(self, topology: Sequence[int]):

def forward(self, x1: torch.Tensor) -> list:
inputs = [x1]
# Downward U:
for layer in self.down_seq.values():
out = layer(inputs[-1])
inputs.append(out)
Expand Down

0 comments on commit 210a5bc

Please sign in to comment.