THOR TerraTorch Extension

April 14, 2026 · View on GitHub

arXiv Models Website

This repository provides the TerraTorch extension for using the THOR (Transformer based foundation model for Heterogeneous Observation and Resolution) model in downstream applications.

The model and pretraining code for THOR can be found here.

Key Features

  • Multi-sensor support: Sentinel-1 (SAR), Sentinel-2 (MSI), Sentinel-3 OLCI & SLSTR
  • Flexible resolution: 10 m to 1000 m native resolutions
  • Compute-adaptive: Flexible patch sizes and ground covers (1000 m to +100,000 m)
  • Data-efficient: State-of-the-art performance in data-limited regimes

Setup

Install using uv:

uv sync

Usage

Finetuning with TerraTorch

To run finetuning on the sen1floods11 dataset with Sentinel-2 and Sentinel-1 data using the THOR ViT Base backbone:

uv run terratorch fit --config config/sen1floods11_thor_multimodal.yaml

The config file uses the custom_modules_path key which should point to the thor_terratorch_ext module. Alternatively, you can specify the module path using the --custom-modules-path argument:

uv run terratorch fit --config config/sen1floods11_thor_multimodal.yaml --custom-modules-path thor_terratorch_ext

Loading the Backbone Directly

You can load the THOR ViT backbone directly in Python:

# Example usage of THOR ViT backbone with terratorch

# Import our custom thor_terratorch_ext module to register THOR backbones
import thor_terratorch_ext  # noqa: F401

# Load the backbone registry
from terratorch import BACKBONE_REGISTRY

# List available THOR backbones
print([b for b in list(BACKBONE_REGISTRY) if "thor" in b])

# Build a THOR ViT model with specific bands
model = BACKBONE_REGISTRY.build(
    "thor_v1_base",
    pretrained=True,
    model_bands=["BLUE", "GREEN", "RED", "VV", "VH"],
    ground_cover=2880,  # Ground cover in meters (typically input image size [px] * input image resolution)
    patch_sizes=8,  # Patch size in pixels
)

THOR backbone parameters

The THOR backbone accepts the following kwargs

ParameterDescriptionExample
ground_coverSpatial extent (in metres) of the crop fed to the ViT2880
patch_sizesFlexiViT patch size(s) to use. Accepts a single int, a list of ints, or a per-modality or per-band dict8, [8, 16], {S2L2A: 8, S1GRD: 16}
ref_patch_sizeReference patch size for the FlexiViT patch embeddings (optional)4

Example usage in a TerraTorch config:

model_args:
  backbone: thor_v1_base
  backbone_ground_cover: 2880
  backbone_patch_sizes: 8
  backbone_merge_method: concat
  backbone_pretrained: true

Attribution

The development of THOR was funded and supported by European Space Agency (ESA) Φ-lab (FM4CS project, contract no. 4000143489/24/I-DT), and the Research Council of Norway (KnowEarth project no. 337481).

Citation

If you use THOR in your research, please cite the paper:

@article{forgaard2026thor,
      title={THOR: A Versatile Foundation Model for Earth Observation Climate and Society Applications}, 
      author={Theodor Forgaard and Jarle H. Reksten and Anders U. Waldeland and Valerio Marsocci and Nicolas Longépé and Michael Kampffmeyer and Arnt-Børre Salberg},
      year={2026},
      eprint={2601.16011},
      archivePrefix={arXiv},
      primaryClass={eess.IV},
      url={https://arxiv.org/abs/2601.16011}, 
}