Upload README.md with huggingface_hub
Browse files
README.md
CHANGED
|
@@ -1,28 +1,93 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
-
|
| 8 |
-
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
-
|
| 19 |
-
-
|
| 20 |
-
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
|
| 22 |
## Usage
|
| 23 |
-
```python
|
| 24 |
-
import torch
|
| 25 |
-
from your_model_loading_code import DeepDEMRefinement
|
| 26 |
|
| 27 |
-
|
| 28 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# DEM Super-Resolution
|
| 2 |
+
|
| 3 |
+
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.
|
| 4 |
+
|
| 5 |
+
## Overview
|
| 6 |
+
|
| 7 |
+
The implementation uses an adapted DeepDEM model with a U-Net architecture (ResNet34 encoder) that takes 7 input channels:
|
| 8 |
+
- SRTM DEM (30m)
|
| 9 |
+
- Sentinel-2 RGB bands (10m)
|
| 10 |
+
- Sentinel-2 NIR band (10m)
|
| 11 |
+
- NDVI
|
| 12 |
+
- Nodata mask
|
| 13 |
+
|
| 14 |
+
The model predicts residual corrections to be added to a smoothed SRTM trend, producing 10m synthetic DEMs.
|
| 15 |
+
|
| 16 |
+
## Requirements
|
| 17 |
+
|
| 18 |
+
- Python 3.8+
|
| 19 |
+
- PyTorch 2.0+
|
| 20 |
+
- PyTorch Lightning
|
| 21 |
+
- Segmentation Models PyTorch
|
| 22 |
+
- Rasterio
|
| 23 |
+
- Geopandas
|
| 24 |
+
- Albumentations
|
| 25 |
+
- Earth Engine API (for data acquisition)
|
| 26 |
+
- GDAL
|
| 27 |
+
- Boto3 (for LiDAR data download)
|
| 28 |
+
|
| 29 |
+
## Installation
|
| 30 |
+
|
| 31 |
+
1. Clone the repository:
|
| 32 |
+
```bash
|
| 33 |
+
git clone https://github.com/yourusername/DEM_SuperRes.git
|
| 34 |
+
cd DEM_SuperRes
|
| 35 |
+
```
|
| 36 |
+
|
| 37 |
+
2. Install dependencies:
|
| 38 |
+
```bash
|
| 39 |
+
pip install torch torchvision torchaudio pytorch-lightning segmentation-models-pytorch rasterio geopandas albumentations scipy gdown earthengine-api boto3
|
| 40 |
+
```
|
| 41 |
+
|
| 42 |
+
3. Install system dependencies:
|
| 43 |
+
```bash
|
| 44 |
+
apt-get install libspatialindex-dev libgdal-dev gdal-bin
|
| 45 |
+
pip install gdal
|
| 46 |
+
```
|
| 47 |
+
|
| 48 |
+
## Data Acquisition
|
| 49 |
+
|
| 50 |
+
The notebook handles data acquisition from:
|
| 51 |
+
- **SRTM 30m DEM**: CGIAR/SRTM90_V4 via Google Earth Engine
|
| 52 |
+
- **Sentinel-2 10m imagery**: COPERNICUS/S2_SR_HARMONIZED via Google Earth Engine
|
| 53 |
+
- **High-resolution LiDAR DEM**: OpenTopography (McKinley Mine, NM)
|
| 54 |
+
|
| 55 |
+
Authenticate with Google Earth Engine and ensure access to required datasets.
|
| 56 |
|
| 57 |
## Usage
|
|
|
|
|
|
|
|
|
|
| 58 |
|
| 59 |
+
1. Open `DEM_SuperRes.ipynb` in Google Colab or Jupyter.
|
| 60 |
+
2. Run cells sequentially to:
|
| 61 |
+
- Acquire and preprocess training data (McKinley)
|
| 62 |
+
- Train the model
|
| 63 |
+
- Acquire and preprocess inference data (Marrakech)
|
| 64 |
+
- Generate synthetic DEM
|
| 65 |
+
- Run validation checks
|
| 66 |
+
|
| 67 |
+
3. Key outputs:
|
| 68 |
+
- Trained model: `Models/deepdem_model.ckpt`
|
| 69 |
+
- Synthetic DEM: `synth_dem_marrakech.tif`
|
| 70 |
+
|
| 71 |
+
## Model Training
|
| 72 |
+
|
| 73 |
+
- **Architecture**: U-Net with ResNet34 encoder, 7 input channels, 1 output channel (residuals)
|
| 74 |
+
- **Loss**: L1 loss
|
| 75 |
+
- **Optimizer**: Adam (lr=1e-4)
|
| 76 |
+
- **Training**: 5 epochs on random crops from McKinley DEM
|
| 77 |
+
- **Data Augmentation**: Random crops, rotations, flips, noise
|
| 78 |
+
|
| 79 |
+
## Validation
|
| 80 |
+
|
| 81 |
+
The notebook includes checks for:
|
| 82 |
+
- Input data statistics and validity
|
| 83 |
+
- Training fit (MAE/RMSE on validation crops)
|
| 84 |
+
- Output alignment and correlation with SRTM trend
|
| 85 |
+
|
| 86 |
+
## Citation
|
| 87 |
+
|
| 88 |
+
If you use this work, please cite the original DeepDEM paper and datasets used.
|
| 89 |
+
|
| 90 |
+
## License
|
| 91 |
+
|
| 92 |
+
[Add your license here]</content>
|
| 93 |
+
<parameter name="filePath">/home/besudo/Git/deepdem/DEM_SuperRes/README.md
|