Model
A Multi-Modal Temporal Vision Transformer for Forest Monitoring and Earth Observation
Naturecode Earth is a foundation model designed for comprehensive forest monitoring, combining satellite imagery analysis with soil property prediction. Built on a hierarchical vision transformer architecture, it processes multi-temporal Sentinel-2 imagery to provide actionable insights for climate and conservation applications.
Naturecode Earth is a 10.9M parameter model (nano variant) that processes:
Input: (B, T, C, H, W) = (batch, 4 timestamps, 6 bands, 64, 64)
+ timestamps: (B, T, 2) [year, day_of_year]
+ locations: (B, 2) [lat, lon]
Encoder:
- Patch embedding (8x8 patches)
- Factorized temporal + spatial attention
- 4 transformer layers
Decoder Heads:
- Segmentation: Forest cover classification (3 classes)
- Biomass: Above-ground biomass estimation (Mg/ha)
- Change Detection: Deforestation/degradation mapping
- Soil Properties: SOC, clay, sand, bulk density, water content
Trained on data from major tropical forest regions:
| Dataset | Description | Resolution |
|---|---|---|
| Sentinel-2 SR Harmonized | Surface reflectance imagery | 10m |
| Global Forest Change (Hansen) | Tree cover, loss, gain | 30m |
| OpenLandMap | Soil properties (SOC, clay, sand, bulk density) | 250m |
Training Configuration:
pip install torch rasterio huggingface_hub
import torch
from huggingface_hub import hf_hub_download
# Download model
model_path = hf_hub_download(
repo_id="naturecodeproject/naturecode-earth",
filename="model.pt"
)
# Load model
checkpoint = torch.load(model_path, map_location="cpu")
config = checkpoint["config"]
# Your ForestFM model class here
from forestfm.model import ForestFM
from forestfm.config import ForestFMConfig
model_config = ForestFMConfig(**config)
model = ForestFM(model_config)
model.load_state_dict(checkpoint["model_state_dict"])
model.eval()
# Inference
# images: (1, 4, 6, 64, 64) - 4 timestamps, 6 bands, 64x64
# timestamps: (1, 4, 2) - year and day_of_year
# locations: (1, 2) - lat, lon
with torch.no_grad():
outputs = model(images, timestamps, locations)
# Forest segmentation
seg_probs = outputs["segmentation"].softmax(dim=1)
# Biomass estimation
biomass = outputs["biomass"]["mean"]
# Soil properties
soc = outputs["soil"]["soc"]
clay = outputs["soil"]["clay"]
| Output | Shape | Description |
|---|---|---|
segmentation | (B, 3, H, W) | Forest cover logits (low/medium/high) |
biomass.mean | (B,) | Above-ground biomass (Mg/ha) |
biomass.aleatoric_std | (B,) | Uncertainty estimate |
change.change_logits | (B, 2, H, W) | Change detection logits |
soil.soc | (B,) | Soil organic carbon (g/kg) |
soil.clay | (B,) | Clay content (%) |
soil.sand | (B,) | Sand content (%) |
soil.bulk_density | (B,) | Bulk density (kg/m3) |
soil.water_content | (B,) | Water content at 33kPa (%) |
| Metric | Value |
|---|---|
| Overall Accuracy | 73.7% (5 epochs, nano) |
| Full Training | 94.4% (100 epochs, A100) |
| Property | MAE |
|---|---|
| SOC | 0.074 (normalized) |
This model was trained with environmental sustainability in mind:
@software{naturecode_earth_2024,
title={Naturecode Earth: Multi-Modal Temporal Vision Transformer for Forest Monitoring},
author={Naturecode},
year={2024},
url={https://huggingface.co/naturecodeproject/naturecode-earth}
}
Apache 2.0