dynamicworld / README.md
fatmur's picture
Keep the published Parquet index and EDA at the dataset root
03677d6 verified
|
Raw History Blame Contribute Delete
11.4 kB
metadata
task_categories:
  - image-segmentation
tags:
  - geospatial
  - sentinel-2
  - dynamic-world
license: cc-by-4.0

Dynamic World annotations and matched L2A imagery

The dataset repository keeps eda.ipynb, labels.yaml and the published Parquet indexes at its root. The Dynamic World bucket holds the original files under raw/ and the current rasters and Parquet indexes under processed/. Resolve each nonempty label_path, image_path or scl_path against hf://buckets/fatmur/dynamicworld/processed/. The current index covers 24,094 prepared labels. The ingestion log, imagery and SCL are published as ingestion progresses.

Download

From the data checkout, install the dependencies with python -m pip install -r requirements.txt. The Python script downloads both bucket prefixes, including the current Parquet indexes, and preserves the paths used by the tables:

python scripts/sync_bucket.py download all

To download just the prepared dataset, use processed in place of all. To download only ingested imagery and SCL as they become available:

python scripts/sync_bucket.py download processed --include 'image/**' --include 'scl/**'

For one split, use --include 'label/val/**' --include 'image/val/**' --include 'scl/val/**'. The dataset repository also provides labels.yaml and versioned Parquet indexes. To fetch those files into the same directory:

from huggingface_hub import snapshot_download

snapshot_download("fatmur/dynamicworld", repo_type="dataset", local_dir=".",
                  allow_patterns=["labels.yaml", "*.parquet"])

Read the label index immediately after download. Its paths work relative to the local processed/ directory.

from pathlib import Path
import geopandas as gpd

processed = Path("processed")
labels = gpd.read_parquet("label.parquet")
first_label = processed / labels.label_path.dropna().iloc[0]

Reproduce

Start with eda.ipynb. It opens the original workbooks, displays their structure, explains annotation sources and voting rules, inspects geography, assigns splits, copies original labels and writes processed/label.parquet. Ingestion is a separate script because downloading imagery is long-running.

Sources and splits

PANGAEA supplies expert and non-expert training annotations, plus individual expert and composite evaluation annotations. Its folder called validation is the same 409-scene final evaluation cohort packaged as Zenodo Test Tiles. Zenodo's lulc band is human ground truth; label and probs_* are predictions. The Zenodo copy stays in raw data; it is not another independent split.

The paper excludes those 409 locations from training and online validation, and evaluates four voting rules with consensus as its primary reference. Strict and consensus are alternate annotations of the same images; they cannot be separate validation/test sets.

Our split Assignment First experiment's labels
train Development locations outside held-out footprints Original expert and non-expert labels
val Seed-0 sample of 20% of eligible expert locations Original expert labels
test All 409 published evaluation locations Supplied consensus composites
excluded Other locations overlapping held-out footprints Not used

Every annotation of a location inherits its split. Training includes both expert and non-expert labels; val uses experts and test uses consensus composites. Each selected annotation is a training sample, even when it shares an image with another annotation. The supplied workbooks have no original train/online-validation assignment. We sample 20% of expert training locations for val with seed 0, after removing test locations and overlaps. Sampling is global, not grouped by biome. Training areas that overlap val are also excluded. Our split is a project choice. This global L2A baseline is not an exact reproduction of the paper's expert-plus-non-expert L1C model. Existing models selected using consensus as validation cannot claim that cohort as an unseen test set merely by renaming it.

Local build layout and flow

raw/                                    unchanged downloads
processed/
├── label.parquet                       EDA: one row per annotation, labels only
├── label/train/{expert,non-expert}/    unchanged original annotations
├── label/val/                          expert annotations
├── label/test/                         expert consensus composites
├── image/...                           ingestion: ten-band L2A image per label, stored DN
├── scl/...                             ingestion: its scene classification (SCL)
└── ingest_log.parquet                  ingestion: one entry per label
scripts/
├── download_labels.py
├── ingest_scenes.py
└── sync_bucket.py
  1. eda.ipynb assigns splits, copies the labels used for training and evaluation and writes label.parquet. Other annotations keep an empty label_path.
  2. scripts/ingest_scenes.py downloads, for each prepared label, the Sentinel-2 L2A acquisition of the label's day onto the label's grid. Image and SCL mirror the label's path: label/train/expert/x.tif -> image/train/expert/x.tif and scl/train/expert/x.tif. Annotations of the same scene each get their own copy.
  3. Merge the two tables on label_path for the full dataset:
import geopandas as gpd
import pandas as pd

labels_df = gpd.read_parquet("processed/label.parquet")
log_df = pd.read_parquet("processed/ingest_log.parquet")
dataset_df = labels_df.merge(log_df, on="label_path")
python scripts/ingest_scenes.py processed --threads 8

The ingest log is saved every 20 labels and on exit. A rerun skips labels logged as written and retries the rest. A failed entry keeps its error and empty paths. No alternate provider or date is substituted.

label.parquet

One row per annotation: annotation_id, scene_id, location_id, annotation_source, annotation_type, voting_rule, source_group, source_path, label_path, date, split, biome, original workbook metadata and a workbook footprint converted to EPSG:4326. Workbook WKT and CRS remain under source_geometry and source_crs. Shared scene and location identifiers use an original dw_id selected by grouping workbook metadata. label_path is relative to processed/; source_path is relative to this repository.

ingest_log.parquet

Column Meaning
label_path the label the image was ingested for
image_path B02 B03 B04 B05 B06 B07 B08 B8A B11 B12, uint16 DN with nodata 0
scl_path SCL, nearest-neighbour resampled; use it as a mask
error why ingestion failed; empty when written

Images keep stored digital numbers. Each file records its scale and offset, derived from the ESA processing baseline of its source products (offset −0.1 from baseline 04.00, 0 before). Decode with each file's own scale and offset.

Upload from the data checkout

Authenticate with hf auth login using an account with write access to the bucket. Preview or run the transfer from the directory containing this README:

python scripts/sync_bucket.py upload all --dry-run
python scripts/sync_bucket.py upload all

Use raw or processed in place of all to sync only one part. The processed upload includes the local Parquet indexes and prepared rasters. Sync adds or updates files and keeps other bucket contents. Both directions default to the data checkout. Use --data-dir to select another local directory. After syncing the referenced rasters, publish the current index to the dataset repository:

hf upload fatmur/dynamicworld processed/label.parquet label.parquet --repo-type dataset
# After ingestion has produced its log:
hf upload fatmur/dynamicworld processed/ingest_log.parquet ingest_log.parquet --repo-type dataset

Original labels and voting

Original TIFF codes, grids, dtype and nodata declarations remain unchanged. labels.yaml describes original codes 0–10, the nine-class dynamic_world mapping, and the eight-class land_cover mapping excluding snow/ice. Remapping happens in memory in the training Dataset. Report eight-class results separately from the paper's nine-class benchmark.

At each pixel, strict requires three agreeing votes; consensus accepts agreement among all non-abstaining experts, even a lone vote; majority accepts two agreeing votes or a lone uncontested vote; simple majority requires two agreeing votes. EDA includes an example table. The paper's prose and some captions disagree; use the supplied composites without recomputing votes. Preliminary comparisons also found pixel discrepancies, so these definitions are not an assertion that every supplied pixel follows the prose exactly.

Training selects all written train rows from experts and non_expert. Validation selects written expert val rows. Complete imagery ingestion is needed to train on the full dataset. Regional fine-tuning is a later experiment. Final primary evaluation selects expert_composites and consensus.

The source training workbook has three S2_GRID values decoded by Excel as dates; EDA retains them as text for Parquet rather than guessing corrected tile IDs. The individual-expert release has one scene with two annotation files instead of three. Both source issues remain visible; raw data is unchanged.

Ingestion study — 2026-11-16 (earlier per-scene layout)

Split Selected scenes Written Missing catalogue acquisition
train 160 160 0
val 40 38 2
test 100 96 4
Total 300 294 6

The first parallel discovery pass hit 49 rate-limit responses. Sequential discovery recovered all 49; completed images and their saved Item provenance were retained. The six remaining searches returned no Planetary Computer Items. A separate check found same-day Earth Search entries for five; the 2017-05-17 Corsica scene was absent from both catalogues within the checked ±1-day window. No provider or date substitution was made. That study's scene.parquet is not part of the current layout.

All 294 discovered acquisitions loaded successfully, including 83 scenes with multiple source Items at the same datetime. The suspected ODC overlap error was not reproduced in this study or in the local overlapping-Item regression. An earlier investigation found an overly strict GeoSave packing check for mixed processing baselines 02.12 and 03.00; it now accepts baselines with the same reflectance offset while rejecting incompatible offsets.

One-off verification confirmed all 27,810 raw files unchanged, all 27,392 prepared labels byte-identical to their sources, exact image/label grids, preserved raster packing, reloadable saved Item documents and no all-zero images. The notebook ran successfully with GeoSave raster plots. Four workspace workflow tests and six Sentinel-2 ingestion tests passed. A one-step real-data training/validation and local release round trip passed; publication was mocked. No benchmark accuracy claim follows from these engineering checks.