A deep learning system for classifying building damage severity from satellite imagery after natural disasters. Given paired pre- and post-disaster satellite images with building annotations, SatDamage predicts per-building damage levels: no-damage, minor-damage, major-damage, or destroyed.
Built on the xView2 (xBD) dataset, covering hurricanes, earthquakes, volcanoes, tsunamis, and wildfires.
Experience the model in action on our interactive web interface: SatDamage Live Demo
For each annotated building, the pipeline:
- Crops the building from both the pre- and post-disaster images
- Concatenates the crops into a 6-channel (128x128) tensor
- Classifies damage severity using a trained CNN or EfficientNet model
The system supports both binary (damaged / not damaged) and multiclass (4-class) classification.
satdamage/
params.py # Configuration & hyperparameters
utils.py # Visualization utilities
ml_logic/
model.py # Model architectures & training loops
preprocessor.py # Data loading, crop extraction, tf.data pipeline
registry.py # Model save/load (local & GCS)
interface/
main.py # Training entry point
evaluate_light.py # Evaluation-only entry point
api/
fast.py # FastAPI inference endpoints
| Architecture | Description |
|---|---|
efficientnet (default) |
EfficientNetV2B0 with 6-to-3 channel projection, 2-phase training (warmup + fine-tune) |
cnn_concat |
Simple 4-block CNN on concatenated 6-channel input |
cnn_dual |
Dual-stream siamese encoder with squeeze-and-excitation attention |
Select the architecture in params.py via MODEL_ARCHITECTURE.
- Python 3.10+
- TensorFlow 2.16.2
pip install -e .Or install dependencies directly:
pip install -r requirements.txtCreate a .env file at the project root:
# Required
DATA_DIR=/path/to/xview2/dataset
MODEL_TARGET=local # "local" or "gcs"
# Optional
CROPS_DIR=data/crops # Where extracted crops are cached
MODEL_FILENAME=model.keras # For evaluate_light
# GCS (required if MODEL_TARGET=gcs)
GCP_PROJECT=your-project
GCP_REGION=your-region
BUCKET_NAME=your-bucketpython -m satdamage.interface.mainThis will:
- Scan the xView2 dataset for image pairs
- Extract and cache building crops to disk
- Split into train/val/test (70/15/15)
- Train the selected model architecture
- Evaluate on the test set and save metrics
Run a pre-trained model on the test set without retraining:
python -m satdamage.interface.evaluate_lightStart the inference API:
uvicorn satdamage.api.fast:app --reloadEndpoints:
POST /predict— Upload pre/post images + annotation JSONs, get per-building damage predictionsGET /models— List loaded modelsGET /— Health check
docker build -t satdamage .
docker run -p 8000:8000 -e PORT=8000 satdamageSatDamage expects the xBD dataset structure:
xview2_root/
{event_name}/
images/
{event_name}_00000000_pre_disaster.png
{event_name}_00000000_post_disaster.png
labels/
{event_name}_00000000_pre_disaster.json
{event_name}_00000000_post_disaster.json
Labels are GeoJSON files containing building polygons with damage severity annotations.
MIT