Skip to content

Fine‑tuning examples for Prithvi‑EO‑2.0 omit mean/std normalization #781

@skynicolettid

Description

@skynicolettid

Description:

I'm raising this issue because I’ve examined the current TerraTorch examples and workflows for Prithvi‑EO‑2.0, and I've noticed that they do not apply Z‑score normalization on input reflectance data during fine-tuning. In contrast, the official Prithvi‑EO‑2.0 inference script (on Hugging Face and the repo) does apply mean/std normalization in the load_example function before passing the tensor to the model.

This creates an inconsistency:

Inference pipeline: input data is normalized with mean and std configured for each band.
TerrTorch fine‑tuning workflows/examples: raw reflectance values are passed directly to the model without normalization.

Why this is a problem:

Inconsistency between fine‑tuning and inference behavior can lead to degraded performance or unexpected results in downstream tasks.
It prevents reproducibility and compatibility with pretrained Prithvi‑EO‑2.0 models, which expect normalized inputs by design.
Users may inadvertently skip normalization and fine‑tune with different data distributions, harming convergence and results.

Suggested Fixes:

Update the TerraTorch example and default DataModule pipeline for Prithvi‑EO‑2.0 to include Z‑score normalization using the same mean and std values provided in model config.
Add a hook or flag (e.g., use_mean_std_normalization=True) in the datamodule to enable this step by default.
Document this explicitly in the TerraTorch tutorial/readme to make clear that normalization is required for compatibility with the official pretrained model.

References:

The inference script for Prithvi‑EO‑2.0 applies normalization: (img - mean)/std in load_example and later rescales output for visualization.
TerraTorch current documentation and datamodule examples define a Normalize(self.means, self.stds) object but never apply it to the dataset items.

Thanks for your excellent work on TerraTorch—this enhancement would improve consistency, reproducibility, and alignment with the official model usage. Please let me know if I can help contribute a code patch or example snippet!

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions