File size: 11,449 Bytes
60a39ef
 
 
 
 
a5d976a
60a39ef
03677d6
ba1d589
699fff4
ba1d589
 
 
 
aaf14d2
 
 
699fff4
 
 
ba1d589
699fff4
 
ba1d589
aaf14d2
699fff4
 
aaf14d2
699fff4
 
ba1d589
aaf14d2
699fff4
 
 
ba1d589
699fff4
 
 
 
03677d6
aaf14d2
 
ba1d589
699fff4
ba1d589
aaf14d2
ba1d589
aaf14d2
 
699fff4
03677d6
ba1d589
aaf14d2
 
 
 
a5d976a
 
 
 
60a39ef
a5d976a
60a39ef
a5d976a
 
 
 
 
 
60a39ef
a5d976a
 
 
 
60a39ef
a5d976a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
03677d6
60a39ef
 
a5d976a
 
 
 
 
 
 
 
 
 
 
ba1d589
699fff4
60a39ef
 
a5d976a
 
 
 
 
 
 
 
 
ba1d589
 
 
a5d976a
 
 
 
60a39ef
a5d976a
 
 
60a39ef
a5d976a
 
 
60a39ef
a5d976a
60a39ef
a5d976a
 
 
 
 
 
 
60a39ef
a5d976a
60a39ef
a5d976a
 
 
 
 
 
60a39ef
a5d976a
 
 
60a39ef
ba1d589
 
 
 
 
699fff4
 
 
ba1d589
 
 
699fff4
 
 
ba1d589
60a39ef
 
03677d6
ba1d589
03677d6
60a39ef
 
a5d976a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
---
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](https://huggingface.co/buckets/fatmur/dynamicworld)
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:

```text
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:

```text
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:

```python
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.

```python
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](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](https://doi.pangaea.de/10.1594/PANGAEA.933475) 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](https://zenodo.org/records/4766508).
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](https://www.nature.com/articles/s41597-022-01307-4) 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

```text
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:

```python
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")
```

```bash
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:

```text
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:

```bash
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.