Skip to content

SWEEP-Inc/sweep-wetlands

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 

Repository files navigation

🟢 Wetlands Detection from Terrain — ASPP U-Net Workflow (SWEEP Demo)

This SWEEP demo shows how to detect inland wetlands using only terrain-derived variables and a lightweight ASPP U-Net model. It uses freely available DEMs (e.g., USGS 3DEP), aligns binary wetland labels, derives slope/curvature-based inputs, and outputs high-resolution wetland probability maps. All steps are orchestrated by a multi-cloud-ready SWEEP DAG.

🌿 Wetlands are among the most valuable carbon sinks on Earth. Yet they remain hard to map. This workflow helps automate detection across catchments using only elevation data — no satellite imagery required.


⚙️ What This Workflow Does

Task Description
fn_read_hucs Reads a list of HUC12 watershed IDs from an input source (e.g., GeoJSON or CSV) and passes them downstream for processing.
fn_fetch_stacks Fetches and stacks terrain-derived rasters (e.g., slope, aspect, TPI, elevation) for each HUC12 and uploads the .tif stack to S3.
predict_huc Downloads the stacked raster from S3, loads a pretrained U-Net model from Hugging Face, runs patch-based prediction, and uploads the binary wetland mask to S3.
mosaicpredictions Mosaics all per-HUC binary wetland predictions into a single output raster (e.g., for a watershed, state, or region). Saves to S3.

🔁 SWEEP DAG (YAML)

name: wetland_detection_unet
description: Derive terrain & predict wetlands using deep learning
steps:
  - name: fn_read_hucs
    function: fn_read_hucs

  - name: fn_fetch_stacks
    function: fn_fetch_stacks
    depends_on: [fn_read_hucs]

  - name: predict_bucket
    function: predict_bucket
    depends_on: [fn_fetch_stacks]

  - name: mosaicpredictions
    function: mosaicpredictions
    depends_on: [predict_bucket]

🧪 Model Details

  • Architecture: ASPP U-Net (4-channel input → 1-channel output)
  • Inputs: slope, aspect, curvature, elevation
  • Loss: Binary Cross Entropy + Dice
  • Training: 128×128 patches
  • Libraries: torch, rasterio, albumentations, numpy

🖼️ Example Output

prediction example


🚀 Quickstart

  1. Clone the repo:
git clone https://github.com/SWEEP-Inc/sweep-wetlands.git
cd demo-workflows/wetlands-demo
  1. Install dependencies:
pip install -r requirements.txt
  1. Deploy with SWEEP:
  1. Trigger full DAG with SWEEP CLI or REST API:
sweep run workflow.yaml --inputs input_dem=data/example_dem.tif

📈 Results (PNW}

Metric Mean ± SD
mIoU 0.73 ± 0.06
F1 Score 0.84 ± 0.05
Precision 0.88 ± 0.04
Recall 0.81 ± 0.07

Note: Performance will vary by watershed depending on label quality and topographic contrast.


📦 License

MIT License — free to use and modify with credit to DotMote Labs / SWEEP.


📬 Contact

DotMote Labs
🌍 https://dotmotelabs.com/sweep.html
📧 hello@sweep.run

Want to use this workflow on your landscape? Need a wetland model developed your region? Get in touch.

About

Mapping Wetlands from Terrain: A Deep Learning Workflow You Can Run on SWEEP

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages