# allenai/planteur-benchmark architecture

> Architecture diagram of the GitHub repository allenai/planteur-benchmark, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-11). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/allenai/planteur-benchmark
- Repository: https://github.com/allenai/planteur-benchmark

## Overview

PLANTEUR is a satellite time-series benchmark for agricultural parcel semantic and panoptic segmentation. Its principal workflow is to prepare crop labels and spatial splits, export aligned Sentinel and Landsat observations plus annotations, then load those patch-level samples or derive parcel pixel sets for model training; variable-length batches can be padded separately. The README also documents monthly mosaics and precomputed embeddings as benchmark products. Generation and loading relationships are grounded in the shown scripts and README; some ancillary generation and product-export details are not sampled.

Main entry points: [`code/dataloader.py`](https://github.com/allenai/planteur-benchmark/blob/main/code/dataloader.py) (Patch loader), [`data_generation/export_planteur_raw.py`](https://github.com/allenai/planteur-benchmark/blob/main/data_generation/export_planteur_raw.py) (S2/S1 export), [`code/dataloader_pixelset.py`](https://github.com/allenai/planteur-benchmark/blob/main/code/dataloader_pixelset.py) (Parcel pixel sets), [`code/collate.py`](https://github.com/allenai/planteur-benchmark/blob/main/code/collate.py) (Temporal padding)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_generation["Dataset generation"]
  node_rawexport["S2/S1 export"]
  node_landsatexport["Landsat export"]
  node_metadata["Metadata rebuild<br/>[rebuild_meta.py]"]
  node_orbits["S1 orbit metadata<br/>[add_orbits_s1.py]"]
end

subgraph group_annotations["Labels and splits"]
  node_rpgmap["RPG class mapping"]
  node_splits["Spatial splits<br/>[assign_splits.py]"]
  node_panoptic["Panoptic labels"]
end

subgraph group_access["Dataset access"]
  node_patchloader["Patch loader<br/>[dataloader.py]"]
  node_pixelsets["Parcel pixel sets"]
  node_collate["Temporal padding<br/>[collate.py]"]
end

subgraph group_products["Benchmark products"]
  node_dataset[("PLANTEUR dataset")]
  node_monthly["Monthly mosaics"]
  node_embeddings["Precomputed embeddings"]
  node_plots["Class distribution reports"]
end

node_user(("Benchmark user"))
node_hub[("Hugging Face Hub")]

node_rpgmap -->|"defines classes"| node_dataset
node_splits -->|"assigns splits"| node_dataset
node_rawexport -->|"exports S2/S1"| node_dataset
node_landsatexport -->|"exports Landsat"| node_dataset
node_panoptic -->|"writes instances"| node_dataset
node_metadata -->|"reuses helpers"| node_rawexport
node_orbits -->|"adds orbit data"| node_dataset
node_hub -->|"hosts dataset"| node_user
node_user -->|"loads patches"| node_patchloader
node_patchloader -->|"reads arrays"| node_dataset
node_user -->|"loads parcels"| node_pixelsets
node_pixelsets -->|"uses loader API"| node_patchloader
node_user -->|"pads batches"| node_collate
node_collate -->|"pads sequences"| node_patchloader
node_user -->|"loads mosaics"| node_monthly
node_user -->|"uses embeddings"| node_embeddings
node_plots -->|"reads labels"| node_dataset

click node_rpgmap "https://github.com/allenai/planteur-benchmark/blob/main/data_generation/build_pastis_rpg_map.py"
click node_splits "https://github.com/allenai/planteur-benchmark/blob/main/data_generation/assign_splits.py"
click node_rawexport "https://github.com/allenai/planteur-benchmark/blob/main/data_generation/export_planteur_raw.py"
click node_landsatexport "https://github.com/allenai/planteur-benchmark/blob/main/data_generation/export_landsat_raw.py"
click node_panoptic "https://github.com/allenai/planteur-benchmark/blob/main/data_generation/export_planteur_panoptic.py"
click node_metadata "https://github.com/allenai/planteur-benchmark/blob/main/data_generation/rebuild_meta.py"
click node_orbits "https://github.com/allenai/planteur-benchmark/blob/main/data_generation/add_orbits_s1.py"
click node_patchloader "https://github.com/allenai/planteur-benchmark/blob/main/code/dataloader.py"
click node_pixelsets "https://github.com/allenai/planteur-benchmark/blob/main/code/dataloader_pixelset.py"
click node_collate "https://github.com/allenai/planteur-benchmark/blob/main/code/collate.py"
click node_plots "https://github.com/allenai/planteur-benchmark/blob/main/data_generation/plot_class_distributions.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_rawexport,node_landsatexport,node_metadata,node_orbits,node_user toneBlue
class node_rpgmap,node_splits,node_panoptic,node_hub toneAmber
class node_patchloader,node_pixelsets,node_collate toneMint
class node_dataset,node_monthly,node_embeddings,node_plots toneRose
```

## Components

### Dataset generation

- [S2/S1 export](https://github.com/allenai/planteur-benchmark/blob/main/data_generation/export_planteur_raw.py): `data_generation/export_planteur_raw.py`
- [Landsat export](https://github.com/allenai/planteur-benchmark/blob/main/data_generation/export_landsat_raw.py): `data_generation/export_landsat_raw.py`
- [Metadata rebuild](https://github.com/allenai/planteur-benchmark/blob/main/data_generation/rebuild_meta.py): `data_generation/rebuild_meta.py`
- [S1 orbit metadata](https://github.com/allenai/planteur-benchmark/blob/main/data_generation/add_orbits_s1.py): `data_generation/add_orbits_s1.py`

### Labels and splits

- [RPG class mapping](https://github.com/allenai/planteur-benchmark/blob/main/data_generation/build_pastis_rpg_map.py): `data_generation/build_pastis_rpg_map.py`
- [Spatial splits](https://github.com/allenai/planteur-benchmark/blob/main/data_generation/assign_splits.py): `data_generation/assign_splits.py`
- [Panoptic labels](https://github.com/allenai/planteur-benchmark/blob/main/data_generation/export_planteur_panoptic.py): `data_generation/export_planteur_panoptic.py`

### Dataset access

- [Patch loader](https://github.com/allenai/planteur-benchmark/blob/main/code/dataloader.py): `code/dataloader.py`
- [Parcel pixel sets](https://github.com/allenai/planteur-benchmark/blob/main/code/dataloader_pixelset.py): `code/dataloader_pixelset.py`
- [Temporal padding](https://github.com/allenai/planteur-benchmark/blob/main/code/collate.py): `code/collate.py`

### Benchmark products

- **PLANTEUR dataset**
- **Monthly mosaics**
- **Precomputed embeddings**
- [Class distribution reports](https://github.com/allenai/planteur-benchmark/blob/main/data_generation/plot_class_distributions.py): `data_generation/plot_class_distributions.py`

### Other components

- **Benchmark user**
- **Hugging Face Hub**

## Connections

- RPG class mapping → PLANTEUR dataset: defines classes (evidence: `data_generation/build_pastis_rpg_map.py`)
- Spatial splits → PLANTEUR dataset: assigns splits (evidence: `data_generation/assign_splits.py`)
- S2/S1 export → PLANTEUR dataset: exports S2/S1 (evidence: `data_generation/export_planteur_raw.py`)
- Landsat export → PLANTEUR dataset: exports Landsat (evidence: `data_generation/export_landsat_raw.py`)
- Panoptic labels → PLANTEUR dataset: writes instances (evidence: `data_generation/export_planteur_panoptic.py`)
- Metadata rebuild → S2/S1 export: reuses helpers (evidence: `data_generation/rebuild_meta.py`)
- S1 orbit metadata → PLANTEUR dataset: adds orbit data (evidence: `data_generation/add_orbits_s1.py`)
- Hugging Face Hub → Benchmark user: hosts dataset (evidence: `README.md`)
- Benchmark user → Patch loader: loads patches (evidence: `README.md`)
- Patch loader → PLANTEUR dataset: reads arrays (evidence: `README.md`)
- Benchmark user → Parcel pixel sets: loads parcels (evidence: `README.md`)
- Parcel pixel sets → Patch loader: uses loader API (evidence: `code/dataloader_pixelset.py`)
- Benchmark user → Temporal padding: pads batches (evidence: `README.md`)
- Temporal padding → Patch loader: pads sequences (evidence: `README.md`)
- Benchmark user → Monthly mosaics: loads mosaics (evidence: `README.md`)
- Benchmark user → Precomputed embeddings: uses embeddings (evidence: `README.md`)
- Class distribution reports → PLANTEUR dataset: reads labels (evidence: `data_generation/plot_class_distributions.py`)
