biomass-model / README.md
pokkiri's picture
Update README.md
d882987 verified
---
title: Biomass Prediction Model
emoji: 🌳
colorFrom: green
colorTo: forest
sdk: gradio
sdk_version: 3.50.2
app_file: app.py
pinned: false
license: mit
---
# Biomass Prediction Model
[![Open In Spaces](https://img.shields.io/badge/🤗-Open%20In%20Spaces-blue.svg)](https://huggingface.co/spaces/vertify/biomass-prediction-app)
[![Python 3.8+](https://img.shields.io/badge/python-3.8+-blue.svg)](https://www.python.org/downloads/)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
## Overview
This model predicts above-ground biomass (AGB) in forest ecosystems using multi-spectral satellite imagery. Developed by vertify.earth for the GIZ Forest Forward initiative, this tool supports sustainable forest management and carbon monitoring efforts. Biomass estimation is a critical component for carbon stock assessment, ecosystem monitoring, and sustainable forest management.
## Model Details
- **Model Type**: StableResNet (Custom PyTorch architecture)
- **Task**: Regression (Biomass prediction in Mg/ha)
- **Input**: Multi-spectral satellite imagery (GeoTIFF format)
- **Output**: Biomass heatmap and statistics
- **Creator**: vertify.earth
- **Partner**: GIZ Forest Forward initiative
- **Date**: May 16, 2025
## Key Features
- **Multi-source Fusion**: Combines data from multiple satellite sensors (Sentinel-1, Sentinel-2, Landsat-8, PALSAR)
- **Advanced Feature Engineering**: Calculates spectral indices, texture features, and spatial context features
- **Stable Architecture**: Uses ResNet-inspired architecture with numerical stability improvements
- **Interactive Visualization**: Provides heatmaps and RGB overlays of biomass predictions
- **Comprehensive Statistics**: Calculates mean, median, min, max, and total biomass for the analyzed area
## Performance
| Metric | Value |
|--------|-----------|
| R² | 0.87 |
| RMSE | 28.7 Mg/ha |
| MAE | 19.5 Mg/ha |
## Use Cases
- **Carbon Stock Assessment**: Estimate carbon sequestration in forests
- **Biodiversity Monitoring**: Monitor forest structure as a proxy for habitat quality
- **Sustainable Forestry**: Plan and monitor sustainable timber harvesting
- **Land Use Change**: Detect and quantify forest degradation and regrowth
- **Climate Change Research**: Monitor changes in biomass over time
## Usage
### Gradio App
The easiest way to use this model is through the provided Gradio interface:
1. Upload a multi-band satellite image in GeoTIFF format
2. Select visualization type (heatmap or RGB overlay)
3. Click "Generate Biomass Prediction"
4. View the biomass map and statistics
### API Usage
```python
import requests
import io
from PIL import Image
# API endpoint
API_URL = "https://api-inference.huggingface.co/models/vertify/biomass-prediction"
headers = {"Authorization": f"Bearer {API_TOKEN}"}
def predict_biomass(filename):
with open(filename, "rb") as f:
data = f.read()
response = requests.post(API_URL, headers=headers, data=data)
return response.json()
# Example usage
result = predict_biomass("path/to/your/satellite_image.tif")
```
### Local Installation
```bash
# Clone the repository
git clone https://huggingface.co/vertify/biomass-prediction
cd biomass-prediction
# Install dependencies
pip install -r requirements.txt
# Run the Gradio app
python app.py
```
### Inference Script
This repository includes a full inference script (`predict_biomass.py`) that allows you to process satellite imagery in batch mode and generate biomass maps:
```bash
# Example usage
python predict_biomass.py --input_dir /path/to/satellite_images --output_dir /path/to/output --visualization_type heatmap
```
For full documentation on the inference script options, see the script header or run:
```bash
python predict_biomass.py --help
```
## Full Training Pipeline
The complete training pipeline, including data preprocessing, feature engineering, model training, and evaluation is available in our [GitHub repository](https://github.com/vertify-earth/biomass-dl-model-training). Please refer to the GitHub repository for detailed documentation on training your own biomass prediction models.
## Input Data Requirements
For optimal results, your satellite imagery should include:
- **Optical bands**: Blue, Green, Red, Near Infrared (NIR), SWIR1, SWIR2
- **Radar bands**: Sentinel-1 VV, VH polarizations (if available)
- **DEM**: Digital Elevation Model (if available)
- **Format**: GeoTIFF with proper georeferencing
The model has been trained on data from various forest types including tropical, temperate, and boreal forests, making it adaptable to different ecosystems.
## Limitations
- Performance may vary in extremely dense forests (>500 Mg/ha) due to saturation effects
- Model accuracy depends on the quality and consistency of input satellite data
- Cloud cover in optical imagery can reduce prediction quality
- Limited validation in certain ecosystem types (e.g., mangroves, wetlands)
## Citation
If you use this model in your research, please cite:
```
@misc{vertify2025biomass,
author = {vertify.earth},
title = {Biomass Prediction Model Using Multi-spectral Satellite Imagery},
year = {2025},
publisher = {HuggingFace},
note = {Developed for GIZ Forest Forward initiative},
howpublished = {\url{https://huggingface.co/spaces/vertify/biomass-prediction}}
}
```
## License
This project is licensed under the MIT License - see the LICENSE file for details.
## Acknowledgements
- Project developed by vertify.earth for the GIZ Forest Forward initiative
- Training data sources include field measurements from various research institutions
- Satellite imagery from ESA Copernicus Programme (Sentinel-1, Sentinel-2) and NASA/USGS (Landsat-8)
- Special thanks to the open-source community for tools and libraries used in this project
## Contact
For questions, feedback, or collaboration opportunities, please reach out via:
- HuggingFace: [@vertify](https://huggingface.co/vertify)
- GitHub: [vertify](https://github.com/vertify)
- Email: info@vertify.earth