DEM Super-Resolution
This repository contains a pipeline for generating synthetic high-resolution Digital Elevation Models (DEMs) by super-resolving 30m SRTM data to 10m resolution, fused with Sentinel-2 imagery. The model is trained on high-resolution LiDAR DEM data from McKinley Mine, NM, and applied to generate DEMs for Marrakech, Morocco.
Overview
The implementation uses an adapted DeepDEM model with a U-Net architecture (ResNet34 encoder) that takes 7 input channels:
- SRTM DEM (30m)
- Sentinel-2 RGB bands (10m)
- Sentinel-2 NIR band (10m)
- NDVI
- Nodata mask
The model predicts residual corrections to be added to a smoothed SRTM trend, producing 10m synthetic DEMs.
Requirements
- Python 3.8+
- PyTorch 2.0+
- PyTorch Lightning
- Segmentation Models PyTorch
- Rasterio
- Geopandas
- Albumentations
- Earth Engine API (for data acquisition)
- GDAL
- Boto3 (for LiDAR data download)
Installation
Clone the repository:
git clone https://github.com/nfl0/DEM_SuperRes.git cd DEM_SuperRes
Install dependencies:
pip install torch torchvision torchaudio pytorch-lightning segmentation-models-pytorch rasterio geopandas albumentations scipy gdown earthengine-api boto3
Install system dependencies:
apt-get install libspatialindex-dev libgdal-dev gdal-bin pip install gdal
Data Acquisition
The notebook handles data acquisition from:
- SRTM 30m DEM: CGIAR/SRTM90_V4 via Google Earth Engine
- Sentinel-2 10m imagery: COPERNICUS/S2_SR_HARMONIZED via Google Earth Engine
- High-resolution LiDAR DEM: OpenTopography (McKinley Mine, NM)
Authenticate with Google Earth Engine and ensure access to required datasets.
Usage
Open
DEM_SuperRes.ipynb
in Google Colab or Jupyter.Run cells sequentially to:
- Acquire and preprocess training data (McKinley)
- Train the model
- Acquire and preprocess inference data (Marrakech)
- Generate synthetic DEM
- Run validation checks
Key outputs:
- Trained model:
Models/deepdem_model.ckpt
- Synthetic DEM:
synth_dem_marrakech.tif
- Trained model:
Model Training
- Architecture: U-Net with ResNet34 encoder, 7 input channels, 1 output channel (residuals)
- Loss: L1 loss
- Optimizer: Adam (lr=1e-4)
- Training: 5 epochs on random crops from McKinley DEM
- Data Augmentation: Random crops, rotations, flips, noise
Validation
The notebook includes checks for:
- Input data statistics and validity
- Training fit (MAE/RMSE on validation crops)
- Output alignment and correlation with SRTM trend