Skip to content

SustainableUrbanSystemsLab/building_footprints

Repository files navigation

Building Footprint Detection

Extracts building footprints from satellite imagery using ESRI's pretrained Mask R-CNN model (usa_building_footprints.dlpk), without ArcGIS Pro.

Download the Model

  1. Download from: USA Building Footprints — ArcGIS Online

  2. Sign in when prompted. Georgia Tech users: use gtmaps as your organization URL:

    ArcGIS login — use gtmaps domain

  3. Click Download to get usa_building_footprints.dlpk

  4. Run 1_inspect_dlpk.py to extract the model files into model/

Requirements

  • Python 3.12
  • NVIDIA GPU recommended (CUDA 12.6+)
  • uv for environment management

Setup

uv venv
uv add torch torchvision --index "https://download.pytorch.org/whl/cu126" --index-strategy unsafe-best-match
uv add arcgis rasterio Pillow numpy shapely scipy matplotlib

Model

Place the ESRI model files in model/ (extracted from usa_building_footprints.dlpk):

model/
├── usa_building_footprints.emd   # model metadata
└── usa_building_footprints.pth   # weights (Mask R-CNN ResNet50 FPN)

Run 1_inspect_dlpk.py to extract them automatically from the .dlpk file.

Pipeline

input/your_image.tif
        ↓
2_predict.py       → output/footprints.geojson
        ↓
4_regularize.py    → output/footprints_reg.geojson
        ↓
3_visualize.py     → output/overlay_raw.png
                      output/overlay_regularized.png

Step 1 — Inspect model (once)

uv run python 1_inspect_dlpk.py

Step 2 — Detect buildings

uv run python 2_predict.py --image input/your_image.tif
Parameter Default Description
--threshold 0.9 Confidence threshold (lower = more detections)
--cell_size 0.3 Target resolution in m/px (model training resolution)
--overlap 256 Tile overlap in pixels (reduces missed edge buildings)
--batch_size 4 Tiles per GPU batch (increase for large images, e.g. 16)

Step 3 — Regularize edges (optional)

Snaps polygon edges to right angles, similar to ArcGIS Pro's Regularize Building Footprint tool.

uv run python 4_regularize.py
Parameter Default Description
--tolerance 1.0 Simplification tolerance in map units before snapping

Step 4 — Visualize

uv run python 3_visualize.py

Produces output/overlay_raw.png and output/overlay_regularized.png (if regularized footprints exist).

Output

  • output/footprints.geojson — raw detected footprints (geo-referenced polygons)
  • output/footprints_reg.geojson — regularized footprints
  • output/overlay_raw.png — visual overlay on satellite image
  • output/overlay_regularized.png — regularized overlay

Notes

  • Input imagery must be a GeoTIFF with a projected CRS (EPSG:3857 recommended)
  • The model was trained on US imagery at 0.3 m/px; imagery is automatically resampled to this resolution
  • GPU is used automatically if available; CPU fallback is supported

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors