Run this model with HF Jobs

Run Lukas3678/TopoDiff-v1-Alpine on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.

Paste one of these prompts into your coding agent:

Fine-tune on my dataset

Use HF Jobs to fine-tune https://huggingface.co/Lukas3678/TopoDiff-v1-Alpine. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.

Run batch inference

Use HF Jobs to run batch inference with https://huggingface.co/Lukas3678/TopoDiff-v1-Alpine on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.

TopoDiff v1 (Alpine) β€” 30m β†’ 5m β†’ 0.5m Terrain Diffusion Cascade

TopoDiff is a two-stage physics-aware residual diffusion cascade (UNet2DModel, v-prediction, DDIM + Classifier-Free Guidance) that super-resolves coarse 30 m Digital Elevation Models (DEMs) via 5 m down to 0.5 m ground resolution.

  • Version: v1-Alpine β€” trained exclusively on high-alpine SwissALTI3D (0.5 m) data (Aletsch Glacier & Matterhorn, 568 kmΒ²) and evaluated strictly out-of-distribution on the Dufourspitze (94 kmΒ²) region. (Planned v2-Global will extend TopoDiff across deserts, plains, karst, and coastal biomes worldwide.)
  • Weights: Stored cleanly in .safetensors format inside weights/.
  • Includes: Standalone CLI (src/topodiff_cli.py), Live Interactive GUI (src/topodiff_gui.py β€” watch DDIM denoising and mosaic assembly in real time!), training script (src/train_topodiff.py), swisstopo dataset CSV manifests (dataset_csv/), and pre-rendered GeoTIFFs for QGIS (assets/qgis_dufour/).

Visual Comparisons (Held-Out Dufourspitze Test Area)

Stage 1 (30 m β†’ 5 m) β€” 1.2 km Γ— 1.2 km Summit Crop

Dufourspitze 5m Heightmap and Shaded Relief Comparison

Full Cascade (30 m β†’ 5 m β†’ 0.5 m) β€” 300 m Γ— 300 m Summit Crop

Dufourspitze 0.5m Heightmap and Shaded Relief Comparison


Out-of-Distribution Demo: K2 Massif (Karakoram, 4,894 m – 8,580 m)

Even though TopoDiff-v1-Alpine was trained solely in the Swiss Alps (≀ 4,634 m), it generalizes zero-shot to a large 7.29 km Γ— 7.89 km (14,580 Γ— 15,780 px at 0.5 m) crop over K2 (EPSG:32643). Both the 30 m input, the 5 m Stage 1 output, and the full 0.5 m cascade GeoTIFFs are included in assets/k2_demo/.

K2 Massif Full Overview Hillshade

K2 Summit Ridge 1.5 km Zoom Hillshade


Benchmarks & Model Overview

Stage Resolution Architecture Weights Held-Out Dufourspitze Benchmark
Stage 1 30 m β†’ 5 m (6Γ—) UNet2DModel (64, 128, 256, 512) Β· 57.89M params weights/stage1_30m_to_5m.safetensors RMSE 2.86 m Β· MAE 1.61 m (vs. Bicubic: 3.87 m RMSE)
Stage 2 5 m β†’ 0.5 m (10Γ—) UNet2DModel (96, 192, 384, 512) Β· 76.42M params weights/stage2_5m_to_05m.safetensors Val-RMSE 0.70 m (Epoch 23)
Full Cascade 30 m β†’ 5 m β†’ 0.5 m (60Γ—) Stage 1 + Stage 2 (1.5 Γ— 1.5 km summit core) Both stages RMSE 3.73 m Β· MAE 2.20 m (vs. Bicubic: 5.09 m RMSE)

Repository Structure

TopoDiff-v1-Alpine/
β”œβ”€β”€ README.md                                  # Model card & overview
β”œβ”€β”€ requirements.txt                           # Python dependencies
β”œβ”€β”€ weights/
β”‚   β”œβ”€β”€ stage1_30m_to_5m.safetensors           # Stage 1 UNet2DModel (30m -> 5m)
β”‚   └── stage2_5m_to_05m.safetensors           # Stage 2 UNet2DModel (5m -> 0.5m)
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ topodiff_core.py                       # Model architecture, safetensors loader & live tiled diffusion engine
β”‚   β”œβ”€β”€ topodiff_cli.py                        # CLI tool for upscaling GeoTIFF DEMs (supports --demo)
β”‚   β”œβ”€β”€ topodiff_gui.py                        # Live Tkinter + Matplotlib GUI (real-time denoising & mosaic view)
β”‚   └── train_topodiff.py                      # Reproducible training script
β”œβ”€β”€ docs/
β”‚   β”œβ”€β”€ ARCHITECTURE.md                        # Residual diffusion, slope/curvature conditioning & loss math
β”‚   β”œβ”€β”€ TUTORIAL_CLI_GUI.md                    # Step-by-step usage guide for GUI, CLI & Python API
β”‚   β”œβ”€β”€ DATASET.md                             # SwissALTI3D dataset details & curl download instructions
β”‚   └── QGIS_3D_GUIDE.md                       # 2D Hillshade & 3D Terrain visualization in QGIS
β”œβ”€β”€ dataset_csv/
β”‚   β”œβ”€β”€ ch.swisstopo.swissalti3d-hfx01UGd.csv  # 485 Aletsch Glacier training tiles
β”‚   β”œβ”€β”€ ch.swisstopo.swissalti3d-matterhorn.csv# 83 Matterhorn training tiles
β”‚   └── ch.swisstopo.swissalti3d-dufour.csv    # 94 Dufourspitze held-out test tiles
└── assets/
    β”œβ”€β”€ region_map.png                         # Zoomed swisstopo map of all train & test tiles
    β”œβ”€β”€ training_curves.png                    # Training & validation curves (Stage 1 & Stage 2)
    β”œβ”€β”€ compare_5m/                            # Stage 1 (5m) 2D & 3D comparison figures
    β”œβ”€β”€ qgis_dufour/                           # Full cascade (0.5m) GeoTIFFs & previews ready for QGIS
    └── k2_demo/                               # Large 7.3 Γ— 7.9 km K2 demo (30m, 5m & 0.5m GeoTIFFs + hillshades)

Study Regions (Switzerland β€” Train vs. Held-Out Test)

SwissALTI3D Study Regions Map

All 662 source GeoTIFF download URLs (EPSG:2056, 0.5 m ground resolution) are included in dataset_csv/. See docs/DATASET.md for download commands.


Training & Validation Curves

Training and Validation Curves


Quickstart (CLI & Live GUI)

git clone https://huggingface.co/Lukas3678/TopoDiff-v1-Alpine
cd TopoDiff-v1-Alpine

python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt

Launch the Live Interactive GUI

Watch DDIM denoising and mosaic tiling happen live on screen:

python src/topodiff_gui.py

Run via CLI

Quick test on a synthetic alpine peak (30 m -> 5 m):

python src/topodiff_cli.py --demo --target 5m --output demo_5m.tif --preview demo_preview.png

Upscale your own metric 30 m GeoTIFF all the way to 0.5 m:

python src/topodiff_cli.py --input my_30m_dem.tif --output out_05m.tif --target 0.5m --preview comparison.png

Detailed Documentation


Limitations & Domain Scope (v1-Alpine)

  • Trained exclusively on high-alpine Swiss terrain (~600 m – 4,634 m). Applying v1-Alpine to flat plains, sand dunes, or urban areas can produce spurious rock-like ridges.
  • Input GeoTIFFs must be in a projected metric CRS (e.g. EPSG:2056 or UTM) with elevations in meters.
  • Elevation and reference map data source: Β© swisstopo (SwissALTI3D).
Downloads last month
-
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support