Prithvi-EO

Model Introduction

Prithvi-EO-2.0 is a foundation model for multi-temporal Earth observation data. It encodes HLS multispectral time series, image acquisition dates, and geographic locations into unified representations and reconstructs masked spatiotemporal patches through a Masked Autoencoder. It can be used for remote-sensing classification, semantic segmentation, regression, and environmental change monitoring.

Paper: Prithvi-EO-2.0: A Versatile Multi-Temporal Foundation Model for Earth Observation Applications
https://arxiv.org/abs/2412.02732

Model Description

Prithvi-EO-2.0 was jointly proposed by IBM, NASA, and the Jülich Supercomputing Centre. The model was trained on 4.2 million global four-timestamp samples from NASA's Harmonized Landsat Sentinel-2 dataset. It is suitable for disaster response, land-cover and crop mapping, ecosystem dynamics monitoring, and remote-sensing image classification, segmentation, and regression tasks.

Use Cases

Use Case Description
Multi-temporal representation Uses a Transformer to jointly encode spatial and temporal information from four time steps.
Remote-sensing image reconstruction Uses a 3D Masked Autoencoder to reconstruct masked multispectral spatiotemporal patches.
Spatiotemporal metadata modeling Integrates year, day of year, latitude, and longitude, with support for randomly dropping metadata during training.
Local engineering validation Uses a small number of synthetic HLS samples to verify the training, inference, evaluation, visualization, and checkpoint workflows.
Multi-GPU training Launches distributed data-parallel training through torchrun.

Usage Instructions

1. OneCode

Experience intelligent, one-click AI4S programming through the OneCode online environment:

Try intelligent, one-click AI4S programming

2. Download and Installation

hf download OneScience-Group/PrithviEO --local-dir ./PrithviEO
cd PrithviEO

Environment Dependencies

Hardware Requirements

  • A GPU or DCU is recommended.
  • A CPU can be used to verify connectivity with the default small-sample configuration; training an official-size model requires large-scale accelerated computing resources.
  • DCU users must install DTK in advance. DTK 25.04.2 or later, or the OneScience-recommended version matching the current cluster, is recommended.

DCU Environment

# Activate DTK and Conda first
conda create -n onescience311 python=3.11 -y
conda activate onescience311
# Installation with uv is supported
pip install onescience[earth-dcu] -i http://mirrors.onescience.ai:3141/pypi/simple/ --trusted-host mirrors.onescience.ai

GPU Environment

# Activate Conda first
conda create -n onescience311 python=3.11 -y libstdcxx-ng=12 libgcc-ng=12 gcc_linux-64=12 gxx_linux-64=12
conda activate onescience311
# Installation with uv is supported
pip install onescience[earth-gpu] -i http://mirrors.onescience.ai:3141/pypi/simple/ --trusted-host mirrors.onescience.ai

Training Data

This repository uses a small number of synthetic samples to validate the engineering workflow. The training and test data are stored in data/train.npz and data/test.npz, respectively. The synthetic data preserve the four time steps and six HLS common bands used in the paper. The band order is Blue, Green, Red, Narrow NIR, SWIR1, and SWIR2, and normalization uses the officially published means and standard deviations.

The synthetic data preserve the 4×224×224 spatiotemporal dimensions used for training in the paper, and each sample's complete image tensor has dimensions 6×4×224×224. Only the number of samples, model width, model depth, and number of training epochs are reduced. This setup validates the 3D Patch Embedding, spatiotemporal positional encoding, temporal and location metadata encoding, and MAE training workflow; it does not represent the data distribution or training scale of the official 4.2 million HLS samples.

python scripts/fake_data.py

Training

python scripts/train.py

For multi-GPU training, use:

torchrun --nproc_per_node=8 --nnodes=1 --rdzv_id=1000 --rdzv_backend=c10d --max_restarts=0 --master_addr="localhost" --master_port=29500 scripts/train.py

The default configuration is intended for rapid workflow validation. Formal experiments should use real HLS time series, the official 300M or 600M configuration, and the complete training schedule.

result/checkpoints/prithvi_eo.pt
result/training/metrics.json

Trained Weights

This repository does not include synthetic or official weights in weight/. IBM and NASA have published the Prithvi-EO-2.0 tiny, 100M, 300M, and 600M weights on Hugging Face, including the TL versions with temporal and location encodings:

https://huggingface.co/ibm-nasa-geospatial/Prithvi-EO-2.0-300M-TL

This repository is a reduced, independent engineering implementation. Its model parameter names and dimensions are not compatible with the official weights. To use the official weights, use TerraTorch or the implementation and data preprocessing workflow provided by the official repository.

Inference

python scripts/inference.py

Inference loads the training checkpoint, generates the CLS embedding, spatiotemporal patch embeddings, multi-temporal reconstructions of masked patches, and the mask, and saves them to:

result/output/predictions.npz

Evaluation and Visualization

python scripts/result.py

The evaluation measures masked-patch MSE, full spatiotemporal reconstruction MAE, reconstruction error for each time step, and embedding norms. It also generates comparison plots of the input images, reconstructions, and absolute errors for all four time steps. Results on synthetic data only validate the engineering workflow and do not represent GEO-Bench performance or performance on real downstream tasks reported in the paper.

result/evaluation/metrics.json
result/evaluation/comparison.png

Official OneScience Information

Citation and License

This repository is an independent engineering reproduction based on the publicly available specifications from the Prithvi-EO-2.0 paper.

Use of this repository's code, the official model weights, and the data remains subject to the licenses and terms of use of their respective projects.

Downloads last month
-
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Paper for OneScience-Group/PrithviEO