added gitignore, smoothened structure slightly

This commit is contained in:
luptmoor
2026-04-10 13:09:53 +02:00
parent e0d4788a11
commit 8f2b071aca

View File

@@ -77,10 +77,10 @@ from pathlib import Path
from typing import NamedTuple from typing import NamedTuple
import numpy as np import numpy as np
import torch import torch # type: ignore
import torch.nn as nn import torch.nn as nn # type: ignore
import torch.nn.functional as F import torch.nn.functional as F # type: ignore
from torch.utils.data import DataLoader, Dataset from torch.utils.data import DataLoader, Dataset # type: ignore
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
@@ -134,14 +134,9 @@ class UpBlock(nn.Module):
avoids checkerboard artefacts common in urban grid-like rasters. avoids checkerboard artefacts common in urban grid-like rasters.
""" """
def __init__( def __init__(self, in_ch: int, skip_ch: int, out_ch: int, dropout_p: float = 0.0):
self,
in_ch: int,
skip_ch: int,
out_ch: int,
dropout_p: float = 0.0,
):
super().__init__() super().__init__()
self.up = nn.Sequential( self.up = nn.Sequential(
nn.Upsample(scale_factor=2, mode="bilinear", align_corners=False), nn.Upsample(scale_factor=2, mode="bilinear", align_corners=False),
nn.Conv2d(in_ch, out_ch, kernel_size=1, bias=False), nn.Conv2d(in_ch, out_ch, kernel_size=1, bias=False),
@@ -231,9 +226,7 @@ class UrbanClimateUNet(nn.Module):
# ── Bottleneck ─────────────────────────────────────────────────────── # ── Bottleneck ───────────────────────────────────────────────────────
# Receives: enc4-pooled (c*8 = 512 ch) + coarse context (128 ch) # Receives: enc4-pooled (c*8 = 512 ch) + coarse context (128 ch)
# → 640 ch input, 512 ch output # → 640 ch input, 512 ch output
self.bottleneck = ConvBlock( self.bottleneck = ConvBlock(c * 8 + coarse_ch, c * 8, dropout_p=dropout_bot)
c * 8 + coarse_ch, c * 8, dropout_p=dropout_bot
)
# ── Decoder ────────────────────────────────────────────────────────── # ── Decoder ──────────────────────────────────────────────────────────
# UpBlock(in_ch, skip_ch, out_ch): # UpBlock(in_ch, skip_ch, out_ch):