File size: 2,710 Bytes
084d378 7f7930a 3dd5404 7f7930a d7e20bb 7f7930a 084d378 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 |
---
license: mit
tags:
- pytorch
- pytorch-lightning
- dem
- super-resolution
- remote-sensing
- geospatial
---
# 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
1. Clone the repository:
```bash
git clone https://github.com/nfl0/DEM_SuperRes.git
cd DEM_SuperRes
```
2. Install dependencies:
```bash
pip install torch torchvision torchaudio pytorch-lightning segmentation-models-pytorch rasterio geopandas albumentations scipy gdown earthengine-api boto3
```
3. Install system dependencies:
```bash
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
1. Open `DEM_SuperRes.ipynb` in Google Colab or Jupyter.
2. 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
3. Key outputs:
- Trained model: `Models/deepdem_model.ckpt`
- Synthetic DEM: `synth_dem_marrakech.tif`
## 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 |