hilarl's picture
v1.0: NatureCode-Mangroves - Swin-Mamba-UNet for global mangrove segmentation (94.91% IoU)
d397a4a verified
---
license: apache-2.0
tags:
- pytorch
- image-segmentation
- remote-sensing
- earth-observation
- mangroves
- carbon-credits
- climate
datasets:
- sentinel-2
- global-mangrove-watch
language:
- en
metrics:
- iou
pipeline_tag: image-segmentation
---
# NatureCode-Mangroves
**Ultimate mangrove monitoring model for carbon credits, biocredits, and nature credits.**
## Model Description
NatureCode-Mangroves is a state-of-the-art deep learning model for mangrove ecosystem monitoring using satellite imagery. It combines:
- **Swin Transformer backbone** for global context understanding
- **Mamba (State-Space) blocks** for efficient long-range dependencies
- **UNet decoder** with attention gates
- **Multi-task learning** with specialized output heads
## Performance
| Metric | Value |
|--------|-------|
| Mangrove IoU | **94.91%** |
| Parameters | 40.2M |
| Training Data | 96 real Sentinel-2 tiles |
## Intended Use
This model is designed for:
- Mangrove extent mapping (segmentation)
- Carbon stock estimation
- Change detection over time
- Biodiversity assessment
- Blue carbon project monitoring
### Carbon Credit Standards
The model outputs are compatible with:
- Verra VCS VM0033 (Tidal Wetland Methodology)
- Gold Standard Mangrove Methodology
- IPCC Tier 2/3 guidelines
- Blue Carbon Initiative
## Usage
```python
import torch
from naturecode_mangroves import create_model
# Load model
model = create_model({'in_channels': 19})
checkpoint = torch.load('pytorch_model.bin', map_location='cpu')
model.load_state_dict(checkpoint['state_dict'])
model.eval()
# Prepare input (19 channels: 10 optical + 4 indices + 3 SAR + 2 extra)
# See prepare_input() function for details
input_tensor = torch.randn(1, 19, 256, 256)
# Run inference
with torch.no_grad():
outputs = model(input_tensor)
segmentation = outputs['segmentation'] # (1, 2, 256, 256)
mangrove_prob = torch.softmax(segmentation, dim=1)[:, 1] # Mangrove probability
```
## Input Format
The model expects 19-channel input:
1. **Bands 0-9**: Sentinel-2 optical bands (B02, B03, B04, B05, B06, B07, B08, B8A, B11, B12)
2. **Bands 10-13**: Spectral indices (NDVI, NDWI, MNDWI, CMRI)
3. **Bands 14-16**: SAR channels (VV, VH, VV/VH ratio) - can be simulated from optical
4. **Bands 17-18**: Extra features (NDVI duplicate, NIR-SWIR average)
## Output Heads
The model produces multiple outputs:
- `segmentation`: Binary mangrove/non-mangrove segmentation
- `agb`: Above-Ground Biomass estimation (Mg/ha)
- `soc`: Soil Organic Carbon (Mg C/ha)
- `health`: Ecosystem health score (0-1)
- Additional heads for species, change detection, etc.
## Training Data
Trained on real Sentinel-2 imagery from:
- Sundarbans (India/Bangladesh)
- Mekong Delta (Vietnam)
- Amazon Delta (Brazil)
- Niger Delta (Nigeria)
- Queensland (Australia)
- Florida (USA)
- And 50+ other global mangrove regions
Labels derived from:
- Global Mangrove Watch (GMW) v4.0
- Spectral index-based pseudo-labels
- Expert validation
## Limitations
- Optimized for 10m resolution Sentinel-2 imagery
- Best performance in tropical/subtropical mangrove regions
- SAR channels are simulated when real SAR not available
- Carbon estimates require calibration for specific regions
## Citation
```bibtex
@software{naturecode_mangroves_2026,
author = {NatureCode Team},
title = {NatureCode-Mangroves: Deep Learning for Mangrove Ecosystem Monitoring},
year = {2026},
url = {https://huggingface.co/naturecode/mangroves}
}
```
## License
Apache 2.0