DenseForestViT v_1_3 final model (P2_L2_seed2)
Browse filesFiles changed (8)
- README.mdAdded+92
- best_model.ptAdded+3
- config.jsonAdded+48
- example_inference.pyAdded+17
- final_val_metrics.jsonAdded+23
- model_v13.pyAdded+187
- stage2_windows.pyAdded+69
- train_loss.csvAdded+11
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192---tags:- remote-sensing- earth-observation- forest-structure- gedi- vision-transformer- multi-task- pytorchpipeline_tag: image-to-imagelibrary_name: pytorch---
# DenseForestViT — native-resolution multi-task forest structure from GEDI and multi-modal EO
DenseForestViT predicts three forest-structure variables at 10 m from one model:
| Output | Meaning | Unit | Output range ||---|---|---|---|| RH | canopy height (GEDI RH98) | m | 0–60 || PAI | plant area index | m² of plant surface per m² of ground | 0–10 || FHD | foliage height diversity (Shannon diversity of the vertical foliage profile) | – | 0–4 |
It was trained on GEDI L2A/L2B labels and eight Earth observation modalities (41 bands, 2024 composites), eachkept at its native resolution: Sentinel-1, Sentinel-2 and Sentinel-2 indices at 10 m; HLS indices, Landsat,Landsat indices, Landsat tasseled cap and SRTM terrain at 30 m.
Paper: Mayer, T., Persello, C., Willemen, L., Griffin, R. (in review). *Mapping Forest Structure with aNative-Resolution Vision Transformer Employing GEDI and Multi-modal Earth Observation Data.*Code: <https://github.com/MayerT1/DenseForestViT>
## Model
- Two token streams: 10 m inputs give one token per pixel (3 × 1,024 tokens); 30 m inputs give one token per 2 × 2 pixels = 60 m (5 × 256 tokens).- Three layers of self-attention within a stream and cross-attention between streams (96-d, 4 heads), with an ALiBi bias by ground distance between token centres.- Convolutional decoder to three sigmoid-bounded heads. An auxiliary head reconstructs the GEDI L1B waveform during training only; inference needs EO data alone.- 861,679 parameters. Checkpoint `best_model.pt` (state dict; most of its size is the precomputed distance-bias buffers). Architecture arguments in `config.json`; code in `model_v13.py`.
## Training
152,308 GEDI-centred 32 × 32 chips from 200 sample areas in 24 Appalachian Level IV ecoregions (42,820 test,22,628 held-out validation; split by 1 km blocks). Huber loss on the 3 × 3 pixels under each GEDI footprint,equal task weights, + 0.2 × waveform loss + 0.001 × total variation. AdamW (lr 2 × 10⁻⁴), effective batch 32,early stopping on GEDI test loss. Selected run: `P2_L2_seed2` (Native-30m geometry, equal task weights).
## Evaluation (airborne lidar, 10 m; 95% block-bootstrap intervals in the paper)
| Site | RH R² | PAI R² | FHD R² ||---|---|---|---|| Sewanee, TN | 0.60 | 0.23 | 0.40 || MLBS, VA | 0.55 | 0.33 | 0.41 || ORNL, TN | 0.72 | 0.50 | 0.49 |
Held-out GEDI validation R²: RH 0.55, PAI 0.28, FHD 0.61. Matched a U-Net for height, exceeded it for PAI at allsites, similar for FHD.
## Use
```bashpip install torch huggingface_hubpython example_inference.py <this repo id>```
Inputs must be prepared exactly as in training with `stage2_windows.py`: for each chip centre, a 32 × 32 windowof every modality at its native resolution, bands selected by name in the order given in that file, missingvalues filled with the window median, each band stretched 0–1 within the window. The trained prediction is thecentre 3 × 3 pixels (30 m) of the output; wall-to-wall maps tile one chip per 3 × 3 block (see`Stage_2_Inference/stage2_run_v13.py` in the code repository).
## Limitations
- Trained and evaluated only in the Appalachian ecoregions of the eastern United States; do not apply elsewhere without retraining and independent validation.- Predictions regress toward the mean: stands taller than about 30 m are predicted at 22–28 m, and PAI saturates near 3 m² m⁻².- Expects 2024-style annual composites built with the recipe in the paper; other compositing will shift inputs.
## Citation
```bibtex@article{Mayer_DenseForestViT, author = {Mayer, Timothy and Persello, Claudio and Willemen, Louise and Griffin, Robert}, title = {Mapping Forest Structure with a Native-Resolution Vision Transformer Employing GEDI and Multi-modal Earth Observation Data}, note = {In review}}```
Funding: NASA Cooperative Agreement 80MSFC22M004 (University of Alabama in Huntsville, NASA Earth Action).123version https://git-lfs.github.com/spec/v1oid sha256:865245d46fef39a70ca227f085dea91070c44e827afebf40b2aad4614a4b4064size 180714210123456789101112131415161718192021222324252627282930313233343536373839404142434445464748{ "model_kwargs": { "embed_dim": 96, "num_layers": 3, "num_heads": 4, "patch_size_8m": 1, "coarse_mods": [ "dem", "hls", "landsat", "landsatidx", "tcap" ], "patch_size_24m": 2, "centred": true, "cross_alibi": true }, "bands_per_cov": { "dem": 2, "hls": 6, "landsat": 5, "landsatidx": 6, "s1": 4, "tcap": 6, "s2": 5, "s2idx": 7 }, "train": { "run": "P2_L2_seed2", "variant": "G1", "seed": 2, "train_frac": 1.0, "epochs": 50, "lr": 0.0002, "batch": 2, "grad_accum": 16, "task_weights": { "rh": 1.0, "pai": 1.0, "fhd": 1.0 }, "lambda_wave": 0.2, "tv_weight": 0.001, "es_patience": 6, "sample_w": "none", "trainer": "train_v13.py (from v_1_2 train_stage1_dense_singlegpu.py)" }}1234567891011121314151617#!/usr/bin/env python3"""Minimal inference with the published DenseForestViT: download, rebuild from config.json, predict one chip.Real inputs must be built with stage2_windows.py (32x32 window per modality at native resolution, NaN -> windowmedian, per-band 0-1 stretch); random numbers are used here only to show shapes."""import json, sys, torchfrom huggingface_hub import hf_hub_downloadREPO = sys.argv[1] if len(sys.argv) > 1 else 'MayerT1/DenseForestViT' # change to your Hub repo idfiles = {f: hf_hub_download(REPO, f) for f in ['config.json', 'best_model.pt', 'model_v13.py']}sys.path.insert(0, str(__import__('pathlib').Path(files['model_v13.py']).parent))from model_v13 import DenseForestViT, SUP_R0, SUP_R1cfg = json.load(open(files['config.json']))model = DenseForestViT(bands_per_cov=cfg['bands_per_cov'], **cfg['model_kwargs']).eval()model.load_state_dict(torch.load(files['best_model.pt'], map_location='cpu', weights_only=False), strict=True)chip = {m: torch.rand(1, c, 32, 32) for m, c in cfg['bands_per_cov'].items()} # replace with stage2_windows.chip(...)with torch.no_grad(): out = model(chip, return_waveform=False)for t in ['rh', 'pai', 'fhd']: # the trained output is the centre 3x3 (30 m) under the chip centre print(t, round(float(out[t][0, SUP_R0:SUP_R1, SUP_R0:SUP_R1].mean()), 3))1234567891011121314151617181920212223{ "rh": { "r2": 0.5504175531875878, "bias": -0.10463162511587143, "rmse": 7.097187519073486, "slope": 0.6028131069900539, "n": 22628 }, "pai": { "r2": 0.27928021182182017, "bias": -0.1023998111486435, "rmse": 1.5529906749725342, "slope": 0.2877121631985449, "n": 21982 }, "fhd": { "r2": 0.6098342005989205, "bias": 0.037768665701150894, "rmse": 0.4305706322193146, "slope": 0.6727707427434952, "n": 21982 }}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187#!/usr/bin/env python3"""DenseForestViT v_1_3 -- aux-waveform ViT with GEOMETRY switches for the Stage 1 ablation.
Defaults reproduce v_1_2 EXACTLY (same modules, same state_dict keys, loads the v_1_2 checkpoint strict=True): coarse_mods=('dem',) patch_size_24m=12 centred=False cross_alibi=False
G1 (geometry fix; data and Stage 2 unchanged, native resolution kept): coarse_mods=('dem','hls','landsat','landsatidx','tcap') all 30 m products in the coarse stream patch_size_24m=2 16x16 coarse tokens (60 m); 12 did not divide 32 centred=True token coordinates measured from the chip centre, so 10 m and 30 m tokens share one ground frame cross_alibi=True distance bias on cross-attention (fine <-> coarse)
Self-test (CPU ok): python model_v13.py [path/to/v_1_2/best_model.pt]"""import torchimport torch.nn as nn
GSD_8M, GSD_24M = 8.0, 24.0 # names kept from v_1_2; only the 1:3 ratio matters for ALiBiPATCH_SIZE_8M_DEFAULT, PATCH_SIZE_24M = 1, 12SUP_R0, SUP_R1, SUP_C0, SUP_C1 = 15, 18, 15, 18ALL_MODS = ['s1', 's2', 's2idx', 'hls', 'landsat', 'landsatidx', 'tcap', 'dem'] # v_1_2 encoder orderV12_COARSE = ('dem',)G1_COARSE = ('dem', 'hls', 'landsat', 'landsatidx', 'tcap')TASK_CEILINGS = {'rh': 60.0, 'pai': 10.0, 'fhd': 4.0}WAVE_LEN = 1420PRESETS = { 'A0': dict(coarse_mods=V12_COARSE, patch_size_24m=12, centred=False, cross_alibi=False), 'G1': dict(coarse_mods=G1_COARSE, patch_size_24m=2, centred=True, cross_alibi=True),}
def get_patch_centers(gsd, patch_size, n_modalities_stacked=1, centred=False): n = 32 // patch_size coords = torch.arange(n, dtype=torch.float32) * (patch_size * gsd) + (patch_size * gsd) / 2.0 if centred: coords = coords - 16.0 * gsd # chip centre = corner of pixel 16 = (0, 0) in both streams xs, ys = torch.meshgrid(coords, coords, indexing='xy') return torch.stack([xs.flatten(), ys.flatten()], dim=1).repeat(n_modalities_stacked, 1)
def compute_alibi_bias(centers_q, centers_k, num_heads): d = torch.cdist(centers_q, centers_k, p=2) slopes = torch.tensor([1.0 / (2 ** (i + 1)) for i in range(num_heads)]) return -slopes.view(-1, 1, 1) * d.unsqueeze(0)
def _expand(bias, B): return bias.unsqueeze(0).expand(B, -1, -1, -1).reshape(B * bias.size(0), bias.size(1), bias.size(2))
class GSDPatchEncoder(nn.Module): def __init__(self, in_channels, embed_dim, patch_size): super().__init__() self.proj = nn.Conv2d(in_channels, embed_dim, kernel_size=patch_size, stride=patch_size) self.norm = nn.LayerNorm(embed_dim)
def forward(self, x): return self.norm(self.proj(x).flatten(2).transpose(1, 2))
class CrossModalLayer(nn.Module): def __init__(self, embed_dim, num_heads): super().__init__() self.self_attn = nn.MultiheadAttention(embed_dim, num_heads, batch_first=True) self.cross_attn = nn.MultiheadAttention(embed_dim, num_heads, batch_first=True) self.ffn = nn.Sequential(nn.Linear(embed_dim, embed_dim * 2), nn.GELU(), nn.Linear(embed_dim * 2, embed_dim)) self.norm1, self.norm2, self.norm3 = nn.LayerNorm(embed_dim), nn.LayerNorm(embed_dim), nn.LayerNorm(embed_dim)
def forward(self, x, context, alibi_self=None, alibi_cross=None): B = x.size(0) x_sa, _ = self.self_attn(x, x, x, attn_mask=None if alibi_self is None else _expand(alibi_self.to(x.dtype), B)) x = self.norm1(x + x_sa) x_ca, _ = self.cross_attn(x, context, context, attn_mask=None if alibi_cross is None else _expand(alibi_cross.to(x.dtype), B)) x = self.norm2(x + x_ca) return self.norm3(x + self.ffn(x))
class ConvBlock(nn.Module): def __init__(self, in_c, out_c): super().__init__() self.block = nn.Sequential(nn.Conv2d(in_c, out_c, 3, padding=1), nn.BatchNorm2d(out_c), nn.GELU(), nn.Conv2d(out_c, out_c, 3, padding=1), nn.BatchNorm2d(out_c), nn.GELU())
def forward(self, x): return self.block(x)
class UNetDecoder(nn.Module): def __init__(self, embed_dim, patch_size_8m): super().__init__() self.grid = 32 // patch_size_8m self.up_blocks = nn.ModuleList([ConvBlock(embed_dim, 32)] if patch_size_8m == 1 else [ConvBlock(embed_dim, 64), nn.ConvTranspose2d(64, 32, 2, stride=2), ConvBlock(32, 32)])
def forward(self, tokens_8m): B, N, E = tokens_8m.shape; n_per = self.grid * self.grid x = tokens_8m.view(B, N // n_per, n_per, E).mean(dim=1) # average co-registered fine modalities x = x.transpose(1, 2).reshape(B, E, self.grid, self.grid) for blk in self.up_blocks: x = blk(x) return x
class ScaledTaskHead(nn.Module): def __init__(self, in_channels, ceiling): super().__init__() self.conv = nn.Conv2d(in_channels, 1, kernel_size=1); self.ceiling = ceiling
def forward(self, x): return torch.sigmoid(self.conv(x).squeeze(1)) * self.ceiling
class DenseForestViT(nn.Module): def __init__(self, bands_per_cov, embed_dim=96, num_layers=3, num_heads=4, patch_size_8m=PATCH_SIZE_8M_DEFAULT, patch_size_24m=PATCH_SIZE_24M, coarse_mods=V12_COARSE, centred=False, cross_alibi=False, verbose=True): super().__init__() assert 32 % patch_size_8m == 0, 'patch_size_8m must divide 32' coarse_mods = tuple(coarse_mods) if coarse_mods != V12_COARSE: assert 32 % patch_size_24m == 0, 'patch_size_24m must divide 32' self.cfg = dict(embed_dim=embed_dim, num_layers=num_layers, num_heads=num_heads, patch_size_8m=patch_size_8m, patch_size_24m=patch_size_24m, coarse_mods=list(coarse_mods), centred=centred, cross_alibi=cross_alibi) self.num_layers = num_layers fine = [m for m in ALL_MODS if m not in coarse_mods and m in bands_per_cov] coarse = [m for m in ALL_MODS if m in coarse_mods and m in bands_per_cov] self.encoders_8m = nn.ModuleDict({m: GSDPatchEncoder(bands_per_cov[m], embed_dim, patch_size_8m) for m in fine}) self.encoders_24m = nn.ModuleDict({m: GSDPatchEncoder(bands_per_cov[m], embed_dim, patch_size_24m) for m in coarse}) self.layers_8m = nn.ModuleList([CrossModalLayer(embed_dim, num_heads) for _ in range(num_layers)]) self.layers_24m = nn.ModuleList([CrossModalLayer(embed_dim, num_heads) for _ in range(num_layers)]) c8 = get_patch_centers(GSD_8M, patch_size_8m, len(fine), centred) self.register_buffer('alibi_8m', compute_alibi_bias(c8, c8, num_heads)) # persistent (v_1_2 key) if coarse: c24 = get_patch_centers(GSD_24M, patch_size_24m, len(coarse), centred) self.register_buffer('alibi_24m', compute_alibi_bias(c24, c24, num_heads)) if cross_alibi: # new in v_1_3: not saved in checkpoints (rebuilt from cfg) self.register_buffer('alibi_x8', compute_alibi_bias(c8, c24, num_heads), persistent=False) self.register_buffer('alibi_x24', compute_alibi_bias(c24, c8, num_heads), persistent=False) self.decoder = UNetDecoder(embed_dim, patch_size_8m) self.head_rh = ScaledTaskHead(32, TASK_CEILINGS['rh']) self.head_pai = ScaledTaskHead(32, TASK_CEILINGS['pai']) self.head_fhd = ScaledTaskHead(32, TASK_CEILINGS['fhd']) self.wave_head = nn.Linear(embed_dim, WAVE_LEN) if verbose: n = 32 // patch_size_8m; nc = 32 // patch_size_24m print(f'DenseForestViT v_1_3 fine={fine} ({len(fine)}x{n * n} tokens) coarse={coarse} ' f'({len(coarse)}x{nc * nc} tokens, patch {patch_size_24m}) centred={centred} cross_alibi={cross_alibi} ' f'params={sum(p.numel() for p in self.parameters()):,}')
def forward(self, batch_dict, return_embeddings=False, return_waveform=True): all_8m = torch.cat([enc(batch_dict[m]) for m, enc in self.encoders_8m.items() if m in batch_dict], dim=1) t24 = [enc(batch_dict[m]) for m, enc in self.encoders_24m.items() if m in batch_dict] all_24m = torch.cat(t24, dim=1) if t24 else all_8m xa = self.cfg['cross_alibi'] and bool(t24) ctx8, ctx24 = all_24m, all_8m for i in range(self.num_layers): all_8m = self.layers_8m[i](all_8m, ctx8, alibi_self=self.alibi_8m if i == 0 else None, alibi_cross=self.alibi_x8 if xa else None) if t24: all_24m = self.layers_24m[i](all_24m, ctx24, alibi_self=self.alibi_24m if i == 0 else None, alibi_cross=self.alibi_x24 if xa else None) ctx8, ctx24 = all_24m, all_8m if return_embeddings: return {'embeddings': all_8m.mean(dim=1)} d = self.decoder(all_8m) out = {'rh': self.head_rh(d), 'pai': self.head_pai(d), 'fhd': self.head_fhd(d)} if return_waveform: out['waveform_pred'] = self.wave_head(all_8m.mean(dim=1)) return out
if __name__ == '__main__': import sys NB = {'dem': 2, 'hls': 6, 'landsat': 5, 'landsatidx': 6, 's1': 4, 'tcap': 6, 's2': 5, 's2idx': 7} torch.manual_seed(0) x = {m: torch.rand(1, b, 32, 32) for m, b in NB.items()} for name, kw in PRESETS.items(): m = DenseForestViT(NB, **kw).eval() with torch.no_grad(): o = m(x, return_waveform=True) print(f' {name}: rh{tuple(o["rh"].shape)} wave{tuple(o["waveform_pred"].shape)} OK') if len(sys.argv) > 1: # A0 must load the v_1_2 checkpoint strictly and match the v_1_2 model output sd = torch.load(sys.argv[1], map_location='cpu', weights_only=False) a0 = DenseForestViT(NB, **PRESETS['A0']).eval(); a0.load_state_dict(sd, strict=True) sys.path.insert(0, '/nas/rstor/tmayer/gedi/scripts/Pipeline_1_2_3_v_1_2_aux_waveform/Stage_1_Dense') from model_dense_vit_v4_patchsweep import DenseForestViT as V12 v12 = V12(NB, embed_dim=96, num_layers=3, num_heads=4, patch_size_8m=1).eval(); v12.load_state_dict(sd, strict=True) with torch.no_grad(): d = (a0(x, return_waveform=False)['rh'] - v12(x, return_waveform=False)['rh']).abs().max().item() print(f' A0 vs v_1_2 (same checkpoint): max |diff| RH = {d:.2e} {"PASS" if d < 1e-5 else "FAIL"}')123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
# stage2_windows.py -- the ONE rule for building Stage 2 model inputs (Colab + HPC)import numpy as np, rasteriofrom scipy.ndimage import map_coordinatesORDER = ['dem', 'hls', 'landsat', 'landsatidx', 's1', 'tcap', 's2', 's2idx'] # == stage1 meta.json eo_listPRODUCT = {'s1': 's1Ascending', 'dem': 'DEMindices', 'hls': 'HLS', 'landsat': 'LandsatComposite', 'landsatidx': 'LandsatIndices', 'tcap': 'landsatTasseledCapIndices', 's2': 'S2Composite', 's2idx': 'S2Indices'}BANDS = {'s1': ['VV', 'VH', 'ratio', 'ndratio'], 'dem': ['dem', 'slope'], 'hls': ['NDVI', 'NDWI', 'MNDWI', 'SAVI', 'NDMI', 'NDBI'], 'landsat': ['red', 'green', 'blue', 'nir', 'swir1'], 'landsatidx': ['NDVI', 'NDWI', 'MNDWI', 'SAVI', 'NDMI', 'NDBI'], 'tcap': ['brightness', 'greenness', 'wetness', 'fourth', 'fifth', 'sixth'], 's2': ['red', 'green', 'blue', 'nir', 'swir1'], 's2idx': ['S2_NDVI', 'S2_NDWI', 'S2_EVI', 'S2_MNDWI', 'S2_SAVI', 'S2_NDMI', 'S2_NDBI']}CHIP, S0 = 32, 15 # 32x32 window; supervised 3x3 = rows/cols 15:18
def load_site(site_dir): # Read the 8 full-AOI tifs; select bands BY NAME; NaN for nodata. out = {} for m in ORDER: with rasterio.open(f'{site_dir}/{PRODUCT[m]}_2024.tif') as s: desc = list(s.descriptions) idx = [desc.index(b) + 1 for b in BANDS[m]] if all(desc) else list(range(1, len(BANDS[m]) + 1)) a = s.read(idx).astype(np.float32) if s.nodata is not None: a[a == s.nodata] = np.nan out[m] = dict(a=a, T=s.transform, crs=s.crs) return out
def centers(site, aoi_bounds=None, stride=3): # Chip centres on the s1 10 m grid: one chip per output 3x3 block (rows r..r+2, cols c..c+2). # Centre = top-left corner of s1 pixel (r+1, c+1), so window rows/cols 15:18 land exactly on r..r+2 / c..c+2. T = site['s1']['T']; H, W = site['s1']['a'].shape[1:] r0 = c0 = 0; r1, c1 = H - 3, W - 3 if aoi_bounds is not None: # (lon0, lat0, lon1, lat1) c0 = max(0, int((aoi_bounds[0] - T.c) / T.a)); c1 = min(W - 3, int((aoi_bounds[2] - T.c) / T.a)) r0 = max(0, int((aoi_bounds[3] - T.f) / T.e)); r1 = min(H - 3, int((aoi_bounds[1] - T.f) / T.e)) rr, cc = np.meshgrid(np.arange(r0, r1 + 1, stride), np.arange(c0, c1 + 1, stride), indexing='ij') rr, cc = rr.ravel(), cc.ravel() return rr, cc, T.c + (cc + 1) * T.a, T.f + (rr + 1) * T.e
def window(prod, lon, lat): # 32x32 window at the product's NATIVE resolution centred on (lon, lat); nearest sampling (GEE default); # NaN -> window median; per-band 0-1 stretch (== training chips). a, T = prod['a'], prod['T']; j = np.arange(CHIP) - (CHIP / 2 - 0.5) xs = lon + j * T.a; ys = lat + j * T.e col = (xs - T.c) / T.a - 0.5; row = (ys - T.f) / T.e - 0.5 R, C = np.meshgrid(row, col, indexing='ij') out = np.empty((a.shape[0], CHIP, CHIP), np.float32) for b in range(a.shape[0]): v = map_coordinates(a[b], [R, C], order=0, mode='constant', cval=np.nan) v = np.zeros_like(v) if np.isnan(v).all() else np.where(np.isnan(v), np.nanmedian(v), v) mn, mx = v.min(), v.max() out[b] = 0 if mx == mn else (v - mn) / (mx - mn) return out
def chip(site, lon, lat): return {m: window(site[m], lon, lat) for m in ORDER}
# ---- validity (added 2026-11-10) ----def raw_window(prod, lon, lat): # same sampling as window(), no fill/stretch: NaN where there is no data a, T = prod['a'], prod['T']; j = np.arange(CHIP) - (CHIP / 2 - 0.5) R, C = np.meshgrid((lat + j * T.e - T.f) / T.e - 0.5, (lon + j * T.a - T.c) / T.a - 0.5, indexing='ij') return np.stack([map_coordinates(a[b], [R, C], order=0, mode='constant', cval=np.nan) for b in range(a.shape[0])])
def chip_valid(site, lon, lat): # centre_ok: supervised 3x3 (10 m) has data in s1 and S2; context: min fraction of valid pixels over the 8 windows cen = all(np.isfinite(raw_window(site[m], lon, lat)[:, S0:S0 + 3, S0:S0 + 3]).all() for m in ['s1', 's2', 's2idx']) ctx = min(float(np.isfinite(raw_window(site[m], lon, lat)).all(0).mean()) for m in ORDER) return cen, ctx1234567891011epoch,train_task_loss,train_wave_loss,test_task_loss,train_tv_loss,epoch_time_min,best_val,es_counter1,2.100514896388425,0.07252742704190915,2.1387112363971097,2.096090117334759,180.79919542074202,2.1387112363971097,02,1.8935642207904073,0.06615729268643361,1.9304685030851143,1.891825518189012,180.89091833035152,1.9304685030851143,03,1.836561233905427,0.06542776211293276,1.952636826688764,1.7602108556576774,180.6580882469813,1.9304685030851143,14,1.8021757243649579,0.06493874907941777,1.8852588328364532,1.6788672976522387,180.6606025616328,1.8852588328364532,05,1.770951931482812,0.064652385168263,1.9804361123131873,1.62517184002261,180.73742399215698,1.8852588328364532,16,1.7422434072465327,0.06439851696671754,1.9681513538902529,1.59145622292067,180.87989513476688,1.8852588328364532,27,1.7180796954360307,0.06416271190456517,1.895523019906504,1.5742100782536483,180.87317779461543,1.8852588328364532,38,1.691776431817148,0.06399564962488956,1.906246764006616,1.5758121032073604,180.62047794262568,1.8852588328364532,49,1.6655188395087712,0.06385947474833654,1.8969597245174616,1.5847337628478786,180.6670950293541,1.8852588328364532,510,1.63717071139436,0.06363350084807222,1.8909126323236727,1.5719216233938498,180.87514660358428,1.8852588328364532,6README.mdAdded+92
best_model.ptAdded+3
config.jsonAdded+48
example_inference.pyAdded+17
final_val_metrics.jsonAdded+23
model_v13.pyAdded+187
stage2_windows.pyAdded+69
train_loss.csvAdded+11