blumenstiel commited on
Commit
d254e9b
·
verified ·
1 Parent(s): 9453ae9

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +49 -2
README.md CHANGED
@@ -13,7 +13,7 @@ viewer: false
13
 
14
  **TerraMesh** merges data from **Sentinel‑1 SAR, Sentinel‑2 optical, Copernicus DEM, NDVI and land‑cover** sources into more than **9 million co‑registered patches** ready for large‑scale representation learning.
15
 
16
- **Dataset release End of June.**
17
 
18
  ![Examples from TerraMesh](assets%2Fexamples.png)
19
 
@@ -23,7 +23,7 @@ Samples from the TerraMesh dataset with seven spatiotemporal aligned modalities.
23
 
24
  ## Dataset organisation
25
 
26
- The archive ships two top‑level splits `train/` and `val/`, each holding one folder per modality. More details follow with the dataset release end of June.
27
 
28
  ---
29
 
@@ -49,6 +49,53 @@ More details in our [paper](https://arxiv.org/abs/2504.11172).
49
 
50
  ---
51
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
52
  ## Citation
53
 
54
  If you use TerraMesh, please cite:
 
13
 
14
  **TerraMesh** merges data from **Sentinel‑1 SAR, Sentinel‑2 optical, Copernicus DEM, NDVI and land‑cover** sources into more than **9 million co‑registered patches** ready for large‑scale representation learning.
15
 
16
+ **Dataset to be released soon.**
17
 
18
  ![Examples from TerraMesh](assets%2Fexamples.png)
19
 
 
23
 
24
  ## Dataset organisation
25
 
26
+ The archive ships two top‑level splits `train/` and `val/`, each holding one folder per modality. More details follow with the dataset release.
27
 
28
  ---
29
 
 
49
 
50
  ---
51
 
52
+ ## Usage
53
+
54
+ We provide the data loading code in `terramesh.py` which can be downloaded via this [link](https://huggingface.co/datasets/ibm-esa-geospatial/TerraMesh/resolve/main/terramesh.py) or with:
55
+ ```
56
+ wget https://huggingface.co/datasets/ibm-esa-geospatial/TerraMesh/resolve/main/terramesh.py
57
+ ```
58
+
59
+ You can use the `build_terramesh_dataset` function to initalize a dataset, which uses the WebDataset package to load samples from the shard files. You can stream the data from Hugging Face or download the full dataset and pass a local path.
60
+ ```python
61
+ from terramesh import build_terramesh_dataset
62
+ from torch.utils.data import DataLoader
63
+
64
+ # If you only pass one modality, the modality is loaded with the "image" key
65
+ dataset = build_terramesh_dataset(
66
+ path="https://huggingface.co/datasets/ibm-esa-geospatial/TerraMesh/resolve/main/", # Streaming or local path
67
+ modalities=["S2L2A"],
68
+ split='val',
69
+ batch_size=8
70
+ )
71
+ # Batch keys: ['__key__', '__url__', 'image']
72
+
73
+ # If you pass multiple modalities, the modalities are returned using the modality names as keys
74
+ dataset = build_terramesh_dataset(
75
+ path="https://huggingface.co/datasets/ibm-esa-geospatial/TerraMesh/resolve/main/", # Streaming or local path
76
+ modalities=["S2L2A", "S1GRD", "S1RTC", "DEM"],
77
+ split='val',
78
+ batch_size=8
79
+ )
80
+
81
+ # Set batch size to None because batching is handled by WebDataset. Otherwise, set it to None in the dataset build
82
+ dataloader = DataLoader(dataset, batch_size=None, num_workers=4)
83
+
84
+ # Iterate over the dataloader
85
+ for batch in dataloader:
86
+ print("Batch keys:", list(batch.keys()))
87
+ # Batch keys: ['__key__', '__url__', 'S2L2A', 'S1RTC', 'DEM']
88
+
89
+ # The code removes the time dim from the source data
90
+ print("Data shape:", batch["S2L2A"].shape)
91
+ # Data shape: torch.Size([8, 12, 264, 264]
92
+ break
93
+ ```
94
+
95
+ If you have any issues with data loading, please create a discussion in the community tab and tag `@blumenstiel`.
96
+
97
+ ---
98
+
99
  ## Citation
100
 
101
  If you use TerraMesh, please cite: