First building height estimation using satelite imagery
## Building Height Estimation in Morocco Using Sentinel-1, Sentinel-2, and DEM
This project implements a deep learning model to estimate per-pixel **building height maps** from satellite imagery. It combines **Sentinel-1 (SAR)**, **Sentinel-2 (MSI)**, and **DEM** inputs in a **ResNet-based multi-branch U-Net** (MBHR-Net), using precomputed height labels from DSM − DEM.
---
## Project Structure
```
├── data/
│ ├── raw/
│ │ ├── sentinel 1/ # Full city SAR images
│ │ ├── sentinel 2/ # Full city MSI images
│ ├── ref/
│ │ ├── dem/ # FABDEM
│ │ ├── dsm/ # AW3D30
│ │ └── heigth/ # Any availabe reference dataset
│ └── splits/
│ └── train_clean.csv # CSV of matched tiles
├── code/
│ ├── models/
│ │ └── architectures.py # MBHR-ResNet model
│ ├── training/
│ │ └── train.py # Training script
│ ├── utils.py # Helpers for DEM, CSV, resizing
│ ├── augment.py # S1/S2/DEM loading + scaling
│ ├── generators.py # Custom tf.keras generator
├── outputs/
│ └── checkpoints, logs, etc.
```
---
## Data Preparation
### 1. **Download Source Data**
Use Google Earth Engine to export:
* **Sentinel-1 (VV, VH)** – GRD monthly average
* **Sentinel-2 (B2, B3, B4, B8)** – monthly median cloud-free
* **AW3D30** (DSM) and **FABDEM** (DEM)
### 2. **Precompute Building Height**
In GEE or Python:
```
building_height = DSM - DEM
```
Export at 10m resolution as GeoTIFF.
### 3. **Place Files**
For each city, place:
* `City_S1_2023.tif` in `data/raw/sentinel 1/`
* `City_S2_2023.tif` in `data/raw/sentinel 2/`
* `City_DEM_2023.tif` in `data/ref/dem/`
* `City_Building_Height_10m.tif` in `data/ref/heigth/`
---
## Generate CSV for Training
Run this script to generate the file `train_clean.csv`:
```bash
python csv_gen.py
```
It will output:
```csv
label_file,s1_file,s2_file,dem_file
Casablanca_Building_Height_10m.tif,Casablanca_S1_2023.tif,C …