Datasets:

Modalities:
Geospatial
Languages:
English
DOI:
Libraries:
License:
cmalbrec commited on
Commit
1b5eb4d
·
verified ·
1 Parent(s): 7b125af

Upload 4 files

Browse files

adjust metadata information including its processing and streaming

Files changed (5) hide show
  1. .gitattributes +1 -0
  2. croissant.json +81 -28
  3. dataset_info.json +1 -1
  4. meta.jsonl +3 -0
  5. ssl4eo_eu_forest.py +98 -31
.gitattributes CHANGED
@@ -65175,3 +65175,4 @@ images/0032791/20180715T100031_20180715T100028_T34VFN/all_bands.tif filter=lfs d
65175
  images/0032791/20181124T095329_20181124T095325_T34VFN/all_bands.tif filter=lfs diff=lfs merge=lfs -text
65176
  images/0032794/20180220T100029_20180220T100220_T34VFN/all_bands.tif filter=lfs diff=lfs merge=lfs -text
65177
  index.jsonl filter=lfs diff=lfs merge=lfs -text
 
 
65175
  images/0032791/20181124T095329_20181124T095325_T34VFN/all_bands.tif filter=lfs diff=lfs merge=lfs -text
65176
  images/0032794/20180220T100029_20180220T100220_T34VFN/all_bands.tif filter=lfs diff=lfs merge=lfs -text
65177
  index.jsonl filter=lfs diff=lfs merge=lfs -text
65178
+ meta.jsonl filter=lfs diff=lfs merge=lfs -text
croissant.json CHANGED
@@ -1,33 +1,86 @@
1
  {
2
- "@context": "https://mlcommons.org/croissant/1.0/context.json",
3
  "@type": "Dataset",
4
- "name": "ssl4eo_eu_forest",
5
- "description": "Multi-temporal forest segmentation dataset with GeoTIFF stacks and masks.",
 
 
 
6
  "data": {
7
- "@type": "FileSet",
8
- "fileStructure": {
9
- "@type": "ParquetFile",
10
- "url": "index.parquet",
11
- "fields": [
12
- {
13
- "name": "sample_id",
14
- "type": "string",
15
- "description": "Unique identifier for each sample."
16
- },
17
- {
18
- "name": "image_paths",
19
- "type": "array",
20
- "items": {
21
- "type": "string"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
22
  },
23
- "description": "List of paths to multi-temporal GeoTIFF images."
24
- },
25
- {
26
- "name": "mask_path",
27
- "type": "string",
28
- "description": "Path to the segmentation mask."
29
- }
30
- ]
31
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
32
  }
33
- }
 
1
  {
2
+ "@context": "https://mlcommons.org/croissant/context/v0.9.json",
3
  "@type": "Dataset",
4
+ "name": "SSL4EO-EU Forest",
5
+ "description": "SSL4EO-EU Forest dataset metadata",
6
+ "identifier": "ssl4eo-eu-forest",
7
+ "license": "https://example.com/license",
8
+ "version": "1.0.0",
9
  "data": {
10
+ "features": [
11
+ {
12
+ "name": "group_id",
13
+ "dataType": "string",
14
+ "description": "group_id field"
15
+ },
16
+ {
17
+ "name": "mask_path",
18
+ "dataType": "string",
19
+ "description": "mask_path field"
20
+ },
21
+ {
22
+ "name": "bbox_epsg4326",
23
+ "isArray": true,
24
+ "description": "bbox_epsg4326 sequence",
25
+ "dataType": "float32"
26
+ },
27
+ {
28
+ "name": "mask_width",
29
+ "dataType": "int32",
30
+ "description": "mask_width field"
31
+ },
32
+ {
33
+ "name": "mask_height",
34
+ "dataType": "int32",
35
+ "description": "mask_height field"
36
+ },
37
+ {
38
+ "name": "dimensions_match",
39
+ "dataType": "bool",
40
+ "description": "dimensions_match field"
41
+ },
42
+ {
43
+ "name": "images",
44
+ "isArray": true,
45
+ "description": "images sequence",
46
+ "features": [
47
+ {
48
+ "name": "path",
49
+ "dataType": "string",
50
+ "description": "path field"
51
  },
52
+ {
53
+ "name": "timestamp_start",
54
+ "dataType": "string",
55
+ "description": "timestamp_start field"
56
+ },
57
+ {
58
+ "name": "timestamp_end",
59
+ "dataType": "string",
60
+ "description": "timestamp_end field"
61
+ },
62
+ {
63
+ "name": "tile_id",
64
+ "dataType": "string",
65
+ "description": "tile_id field"
66
+ },
67
+ {
68
+ "name": "season",
69
+ "dataType": "string",
70
+ "description": "season field"
71
+ },
72
+ {
73
+ "name": "width",
74
+ "dataType": "int32",
75
+ "description": "width field"
76
+ },
77
+ {
78
+ "name": "height",
79
+ "dataType": "int32",
80
+ "description": "height field"
81
+ }
82
+ ]
83
+ }
84
+ ]
85
  }
86
+ }
dataset_info.json CHANGED
@@ -1 +1 @@
1
- {"description": "", "citation": "", "homepage": "", "license": "", "features": {"sample_id": {"dtype": "string", "_type": "Value"}, "image_paths": {"feature": {"dtype": "string", "_type": "Value"}, "_type": "Sequence"}, "mask": {"dtype": "string", "_type": "Value"}}}
 
1
+ {"description": "SSL4EO-EU Forest dataset metadata", "citation": "@misc{ssl4eo_eu_forest,\nauthor = {Nassim Ait Ali Braham and Conrad M Albrecht},\ntitle = {SSL4EO-EU Forest Dataset},\nyear = {2025},\nhowpublished = {https://huggingface.co/datasets/dm4eo/ssl4eo-eu-forest},\nnote = {This work was carried under the EvoLand project, cf. https://www.evo-land.eu . This project has received funding from the European Union's Horizon Europe research and innovation programme under grant agreement No. 101082130.}\n}", "homepage": "https://www.evo-land.eu", "license": "CC-BY-4.0", "features": {"group_id": {"dtype": "string", "_type": "Value"}, "mask_path": {"dtype": "string", "_type": "Value"}, "bbox_epsg4326": {"feature": {"dtype": "float32", "_type": "Value"}, "_type": "Sequence"}, "mask_width": {"dtype": "int32", "_type": "Value"}, "mask_height": {"dtype": "int32", "_type": "Value"}, "dimensions_match": {"dtype": "bool", "_type": "Value"}, "images": {"feature": {"path": {"dtype": "string", "_type": "Value"}, "timestamp_start": {"dtype": "string", "_type": "Value"}, "timestamp_end": {"dtype": "string", "_type": "Value"}, "tile_id": {"dtype": "string", "_type": "Value"}, "season": {"dtype": "string", "_type": "Value"}, "width": {"dtype": "int32", "_type": "Value"}, "height": {"dtype": "int32", "_type": "Value"}}, "_type": "Sequence"}}, "supervised_keys": {"input": "images", "output": "mask_path"}}
meta.jsonl ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f8bffa999ebbf5e1104a6e0b16b65823cc241cc038ae005a8ffe61722bcee829
3
+ size 22206061
ssl4eo_eu_forest.py CHANGED
@@ -1,43 +1,110 @@
1
 
 
2
  import datasets
3
- import logging
4
 
5
- # Configure logging
6
- logger = logging.getLogger(__name__)
7
- logging.basicConfig(level=logging.INFO)
8
-
9
- class ForestSegmentationDataset(datasets.GeneratorBasedBuilder):
10
  def _info(self):
11
- logger.info("Defining dataset schema...")
 
 
12
  return datasets.DatasetInfo(
 
13
  features=datasets.Features({
14
- "sample_id": datasets.Value("string"),
15
- "image_paths": datasets.Sequence(datasets.Value("string")),
16
- "mask": datasets.Value("string"),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
17
  }),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
18
  )
19
 
20
  def _split_generators(self, dl_manager):
21
- logger.info("Loading sample stream from index.parquet...")
22
- sample_stream = dl_manager.iter_parquet("index.parquet")
23
- logger.info("Sample stream loaded successfully.")
24
- return [
25
- datasets.SplitGenerator(
26
- name=datasets.Split.TRAIN,
27
- gen_kwargs={"samples": sample_stream}
28
- )
29
- ]
 
 
 
 
 
30
 
31
- def _generate_examples(self, samples):
32
- logger.info("Starting to generate examples...")
33
- for i, sample in enumerate(samples):
34
- if i % 1000 == 0:
35
- logger.info(f"Processed {i} samples...")
36
- try:
37
- yield sample["sample_id"], {
38
- "sample_id": sample["sample_id"],
39
- "image_paths": sample["image_paths"],
40
- "mask": sample["mask_path"],
 
 
 
 
 
 
 
 
 
41
  }
42
- except Exception as e:
43
- logger.error(f"Error processing sample {sample.get('sample_id', 'unknown')}: {e}")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
 
2
+ import json
3
  import datasets
 
4
 
5
+ class SSL4EOEUForest(datasets.GeneratorBasedBuilder):
6
+ """
7
+ Metadata generator for the SSL4EO-EU-Forest dataset, cf. https://huggingface.co/datasets/dm4eo/ssl4eo_eu_forest .
8
+ """
 
9
  def _info(self):
10
+ """
11
+ Provides details on metadata structure, citation, and credits.
12
+ """
13
  return datasets.DatasetInfo(
14
+ description="SSL4EO-EU Forest dataset metadata",
15
  features=datasets.Features({
16
+ # data sample ID
17
+ "group_id": datasets.Value("string"),
18
+ # relative path (without HuggingFace URL) of forest mask
19
+ "mask_path": datasets.Value("string"),
20
+ # got bounding box in lat-lon coords
21
+ "bbox_epsg4326": datasets.Sequence(datasets.Value("float32")),
22
+ # image dimensions in width and height
23
+ "mask_width": datasets.Value("int32"),
24
+ "mask_height": datasets.Value("int32"),
25
+ # do the above dimensions match for all the images?
26
+ "dimensions_match": datasets.Value("bool"),
27
+ # 12-band Sentinel-2 L2A cloud-free images for all seasons in bounding box
28
+ "images": datasets.Sequence({
29
+ # relative path (without HuggingFace URL) of Sentinel-2 imagery
30
+ "path": datasets.Value("string"),
31
+ # start time for data recording
32
+ "timestamp_start": datasets.Value("string"),
33
+ # end time for data recording
34
+ "timestamp_end": datasets.Value("string"),
35
+ # Sentinel-2 tile ID
36
+ "tile_id": datasets.Value("string"),
37
+ # season in northern hemisphere
38
+ "season": datasets.Value("string"),
39
+ # image dimensions
40
+ "width": datasets.Value("int32"),
41
+ "height": datasets.Value("int32")
42
+ })
43
  }),
44
+ # which keys refer to (input, output) data for supervised
45
+ supervised_keys=("images", "mask_path"),
46
+ # BibTeX on how to cite this work
47
+ citation="""@misc{ssl4eo_eu_forest,
48
+ author = {Nassim Ait Ali Braham and Conrad M Albrecht},
49
+ title = {SSL4EO-EU Forest Dataset},
50
+ year = {2025},
51
+ howpublished = {https://huggingface.co/datasets/dm4eo/ssl4eo-eu-forest},
52
+ note = {This work was carried under the EvoLand project, cf. https://www.evo-land.eu . This project has received funding from the European Union's Horizon Europe research and innovation programme under grant agreement No. 101082130.}
53
+ }""",
54
+ # project homepage
55
+ homepage="https://www.evo-land.eu",
56
+ # data license
57
+ license="CC-BY-4.0",
58
  )
59
 
60
  def _split_generators(self, dl_manager):
61
+ """
62
+ Define dataset splits - single "training" split for now.
63
+ """
64
+ # Streaming mode doesn't download files
65
+ return [datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"filepath": self.config.data_files["train"]})]
66
+
67
+ def _generate_examples(self, filepath):
68
+ """
69
+ Streaming-compliant serving of metadata for SSL4EO data samples.
70
+ """
71
+ with open(filepath, encoding="utf-8") as f:
72
+ for idx, line in enumerate(f):
73
+ yield idx, json.loads(line)
74
+
75
 
76
+ def features_to_croissant(features):
77
+ """
78
+ Convert a HF dataset feature into a Croissant-compatible description.
79
+ """
80
+ def convert_feature(name:str, feature:datasets.features.features.Features):
81
+ if isinstance(feature, datasets.Value):
82
+ return {
83
+ "name": name,
84
+ "dataType": feature.dtype,
85
+ "description": f"{name} field"
86
+ }
87
+ elif isinstance(feature, datasets.Sequence):
88
+ inner = feature.feature
89
+ if isinstance(inner, dict): # nested structure
90
+ return {
91
+ "name": name,
92
+ "isArray": True,
93
+ "description": f"{name} sequence",
94
+ "features": [convert_feature(k, v) for k, v in inner.items()]
95
  }
96
+ elif isinstance(inner, Value): # flat sequence
97
+ return {
98
+ "name": name,
99
+ "isArray": True,
100
+ "description": f"{name} sequence",
101
+ "dataType": inner.dtype
102
+ }
103
+ else:
104
+ return {
105
+ "name": name,
106
+ "dataType": "unknown",
107
+ "description": f"{name} field"
108
+ }
109
+
110
+ return [convert_feature(name, feature) for name, feature in features.items()]