DEM-SR β 30 m β 10 m DEM super-resolution (High Mountain Asia)
Checkpoints for the two trained models of the DEM super-resolution thesis project: upsampling a 30 m NASADEM digital elevation model to 10 m, conditioned on the co-registered Sentinel-2 RGB image, over 40 sites in High Mountain Asia.
- Code (training & evaluation): https://github.com/Bishalai/DEM_SR
- Task: 3Γ super-resolution in each dimension (one 30 m cell β nine 10 m cells)
- Conditioning: bicubic-upsampled 30 m DEM + Sentinel-2 RGB (10 m, 3 bands)
- Output: a residual added to the bicubic-upscaled input
Models in this repository
| Folder | Architecture | Params | Checkpoint size | Description |
|---|---|---|---|---|
unet_b64/ |
ResUNet-SR (deterministic) | 17.8 M | 272 MB | Direct residual regression; L1 + slope-consistency loss |
rf_b64/ |
RFVelocityUNet (rectified flow) | 42.8 M | 653 MB | Flow-matched residual generation with CFG guidance |
Each folder contains:
| File | Contents |
|---|---|
ckpt_best.pt |
Best validation RMSE so far β use this one (EMA weights) |
ckpt_last.pt |
Latest step (for resuming training) |
config.json |
Full training hyper-parameters of the run |
log.csv |
Per-step training/validation metrics |
status.json |
Run state, current step, best RMSE |
guidance_sweep.csv |
(rf only) CFG-guidance sweep results |
Checkpoints are standard torch.save dicts:
{
"model": ..., "ema": ..., "opt": ..., "sched": ..., "scaler": ...,
"step": int, "best": float, "args": dict, # args = architecture + hyper-params
"rng": ..., "sampler_gen": ..., "time": str
}
Inference always uses the "ema" state dict, and the architecture is
reconstructed from "args" β so nothing is hard-coded.
Training data
Paired, co-registered patches derived from a 40-site dataset of High Mountain Asia (10 mountains / 10 ridges / 10 hills / 10 plains, 100 Γ 100 km each):
| Split | Patches |
|---|---|
| train | 53,838 |
| val | 9,427 |
| test | 4,197 |
| total | 67,462 |
Each patch: 80 Γ 80 LR (30 m) β 240 Γ 240 HR (10 m), plus the co-registered 240 Γ 240 Γ 3 RGB. Sources: NASA HMA 8 m mosaic (resampled to the 10 m reference), NASADEM 1 arc-second (30 m), Sentinel-2 L2A (RGB). Per-patch z-scoring uses the LR statistics; metrics are denormalised to metres. The dataset itself is not published in this repository.
Training details
unet_b64 |
rf_b64 |
|
|---|---|---|
| Steps (paused at) | 45,980 / 50,000 | 64,014 / 80,000 |
| Best val RMSE | 2.291 m (ckpt @ step 44,000) | 4.118 m (ckpt @ step 58,000) |
| Base width / blocks | 64 / 2 | 80 / 3 |
| Channel mults | 1,2,4,4 | 1,2,4,4 |
| Attention / dropout | level 3 / β | level 3 / 0.1 |
| Conditioning | RGB | RGB + pyramid conditioning, CFG (p = 0.1) |
| Loss | L1 + slope-consistency (Ξ» = 0.3) | masked MSE on flow velocity |
| Sampler | β | Euler, NFE 8 |
| Optimiser / schedule | AdamW, cosine + warmup | AdamW, cosine + warmup |
| Precision | AMP bf16 | AMP bf16 (fp16 diverged) |
| EMA decay | 0.999 | 0.9999 |
| Batch (micro Γ accum) | 4 Γ 2 | 4 Γ 1 |
| Class-balanced sampling | yes | yes |
Trained on a single 8 GB consumer GPU (RTX 4060) under a hard 7.5 GB VRAM cap, ~500 ms/step for the RF model.
Note: both runs were paused before their final step budget (see
status.json).ckpt_best.ptis the best validation checkpoint reached so far; training can be resumed fromckpt_last.ptwith the scripts in the GitHub repository.
Results (held-out test set)
256 sampled test patches, blank/missing pixels masked, raw predictions
(no post-processing). Source: runs1/test_evaluation/summary_rf_b64_vs_unet_b64.csv.
| Model | RMSE (m) | MAE (m) | Slope MAE (Β°) | TRI MAE (m) | SSIM | PSNR (dB) |
|---|---|---|---|---|---|---|
| Bicubic Γ3 (input baseline) | 7.199 | 5.532 | 5.194 | 2.903 | 0.9158 | 35.89 |
| rf_b64 (rectified flow) | 5.085 | 3.806 | 3.475 | 1.983 | 0.9557 | 39.45 |
| unet_b64 (ResUNet-SR) | 4.073 | 3.033 | 2.931 | 1.679 | 0.9674 | 41.27 |
Both learned models beat the bicubic floor; the deterministic U-Net is the
stronger of the two on this benchmark. The RF model's guidance scale can be
tuned per checkpoint (guidance_sweep.csv, best β 1.25 at NFE 8).
How to load
Requires the model definitions from the
GitHub repository (scripts/models_sr.py).
import torch
from models_sr import ResUNetSR, RFVelocityUNet # from the GitHub repo
device = "cuda" if torch.cuda.is_available() else "cpu"
# --- Deterministic U-Net ---
ckpt = torch.load("unet_b64/ckpt_best.pt", map_location="cpu", weights_only=False)
args = ckpt["args"]
unet = ResUNetSR(args["base"])
unet.load_state_dict(ckpt["ema"]) # EMA weights = the model to use
unet.to(device).eval()
# --- Rectified-flow U-Net ---
ckpt = torch.load("rf_b64/ckpt_best.pt", map_location="cpu", weights_only=False)
args = ckpt["args"]
use_pyr = any(k.startswith("cond_pyramid.") for k in ckpt["ema"])
rf = RFVelocityUNet(
args["base"],
mults=tuple(int(x) for x in str(args["mults"]).split(",")),
blocks=args["blocks"],
attn_levels=tuple(int(x) for x in str(args["attn_levels"]).split(",")),
dropout=args["dropout"],
use_pyr=use_pyr,
)
rf.load_state_dict(ckpt["ema"])
rf.to(device).eval()
Full inference (georeferenced GeoTIFFs)
For whole-scene inference with tiling, RGB conditioning and georeferencing, use
predict_sr.py from the GitHub repository (it reads checkpoints out of
runs1/<name>/, so place the downloaded folders there):
git clone https://github.com/Bishalai/DEM_SR.git
# put unet_b64/ and rf_b64/ into DEM_SR/runs1/
python scripts1\predict_sr.py --dem-dir 30mdem --rgb-dir rgb_sentinel2 `
--model rf --guidance 1.25 --nfe 8
Outputs are 10 m GeoTIFFs (3Γ the input dimensions), CRS and origin inherited
from the 30 m input, nodata -32768.
Evaluation on the test split:
python scripts1\evaluate_test.py --rf-name rf_b64 --unet-name unet_b64 --val-sample 256
Limitations
- Region-specific: trained on High Mountain Asia only; vertical datum is EGM96 orthometric metres, CRS is Albers Equal Area (ESRI:102008).
- Runs are incomplete: checkpoints come from paused training runs after the loss converged, but before the full step budget was reached (rf 64k/80k steps, unet 46k/50k steps).
- The 30 m input carries a systematic level offset vs the 10 m reference
(tens of metres per patch); the evaluation scripts can compensate
(
--use-offsetinevaluate_test_updated.py). - Research checkpoints β no licence granted by default; contact the author before redistribution or commercial use.