ZL233 commited on
Commit
3de5716
·
verified ·
1 Parent(s): c641da0

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +103 -91
README.md CHANGED
@@ -14,11 +14,9 @@ size_categories:
14
 
15
  ## 🚧 Dataset Upload in Progress
16
 
17
- GeoSR-Bench is currently being uploaded and reorganized.
18
 
19
- Some files, metadata, and subsets may still be incomplete or subject to change.
20
-
21
- ---
22
 
23
  ## Dataset Description
24
 
@@ -53,136 +51,150 @@ The dataset contains both SR-only datasets and downstream task datasets.
53
 
54
  ```text
55
  SRDatasetName/
56
- ├── lr/ or modis/ or s2/
57
- │ ├── lr_0.tif
58
- │ ├── lr_1.tif
59
  │ └── ...
60
- ├── hr/ or l8/ or naip/
61
- │ ├── hr_0.tif
62
- │ ├── hr_1.tif
63
  │ └── ...
64
- ├── meta/
65
- │ ├── meta_0.json
66
- │ ├── meta_1.json
67
  │ └── ...
68
- └── SRDatasetName_split_all.csv
 
 
 
 
 
 
 
 
 
 
 
69
  ```
70
 
71
  ### Downstream task dataset
72
 
73
  ```text
74
  DownstreamDatasetName/
75
- ├── s2/ or modis/
76
- │ ├── s2_0.tif
77
- │ ├── s2_1.tif
78
- │ └── ...
79
- ├── naip/ or l8/
80
- │ ├── naip_0.tif
81
- │ ├── naip_1.tif
82
- │ └── ...
83
- ├── label/
84
- │ ├── label_0.tif
85
- │ ├── label_1.tif
86
- │ └── ...
87
- ├── meta/
88
- │ ├── meta_0.json
89
- │ ├── meta_1.json
90
- │ └── ...
91
- └── DownstreamDatasetName_split_all.csv
92
  ```
93
 
94
- ## Split Files
95
 
96
- Each subset includes a CSV file describing the image paths and data split.
 
 
 
 
 
 
 
 
 
 
97
 
98
- SR-only datasets are intended for training super-resolution models and do not have predefined train/validation/test split files.
99
 
100
- For downstream task datasets, the CSV contains:
101
 
102
- ```text
103
- LR image,HR image,Label,split
104
- DownstreamDatasetName/s2/s2_0.tif,DownstreamDatasetName/naip/naip_0.tif,DownstreamDatasetName/label/label_0.tif,training
105
- DownstreamDatasetName/s2/s2_1.tif,DownstreamDatasetName/naip/naip_1.tif,DownstreamDatasetName/label/label_1.tif,validation
106
- DownstreamDatasetName/s2/s2_2.tif,DownstreamDatasetName/naip/naip_2.tif,DownstreamDatasetName/label/label_2.tif,test
107
- ```
108
 
 
 
 
 
 
109
 
110
- ## Data Fields
111
 
112
- | Column | Description |
113
- |---|---|
114
- | `LR image` | Path to the lower-resolution input image |
115
- | `HR image` | Path to the higher-resolution reference image |
116
- | `Label` | Path to the downstream task label |
117
- | `split` | Dataset split: `training`, `validation`, or `test` |
118
 
119
- ## File Formats
 
 
120
 
121
- - Images are stored as GeoTIFF files (`.tif`).
122
- - Labels are stored as GeoTIFF files (`.tif`).
123
- - Metadata files, when available, are stored as JSON files (`.json`).
124
- - Split files are stored as CSV files (`.csv`).
125
 
126
- GeoTIFF files retain geospatial metadata such as coordinate reference system, transform, resolution, and spatial extent.
127
 
128
- ## Usage
 
 
 
129
 
130
- You can read the split CSV using Python:
131
 
132
  ```python
 
 
133
  import pandas as pd
 
134
 
135
- csv_path = "DownstreamDatasetName/DownstreamDatasetName_split_all.csv"
136
- df = pd.read_csv(csv_path)
137
 
138
- train_df = df[df["split"] == "training"]
139
- val_df = df[df["split"] == "validation"]
140
- test_df = df[df["split"] == "test"]
141
 
142
- print(len(train_df), len(val_df), len(test_df))
143
- ```
 
144
 
145
- For SR-only datasets, use the `LR image` and `HR image` columns:
 
 
146
 
147
- ```python
148
- sample = train_df.iloc[0]
 
149
 
150
- lr_path = sample["LR image"]
151
- hr_path = sample["HR image"]
152
 
153
- print(lr_path)
154
- print(hr_path)
 
155
  ```
156
 
157
- For downstream task datasets, use the `LR image`, `HR image`, and `Label` columns:
158
 
159
  ```python
160
- sample = train_df.iloc[0]
 
161
 
162
- lr_path = sample["LR image"]
163
- hr_path = sample["HR image"]
164
- label_path = sample["Label"]
165
 
166
- print(lr_path)
167
- print(hr_path)
168
- print(label_path)
169
- ```
170
 
171
- You can read GeoTIFF files using `rasterio`:
 
172
 
173
- ```python
174
- import rasterio
175
-
176
- with rasterio.open("DownstreamDatasetName/s2/s2_0.tif") as src:
177
- image = src.read()
178
- crs = src.crs
179
- transform = src.transform
180
-
181
- print(image.shape)
182
- print(crs)
183
- print(transform)
184
  ```
185
 
 
186
  ## Intended Use
187
 
188
  This dataset is intended for research on:
 
14
 
15
  ## 🚧 Dataset Upload in Progress
16
 
17
+ The GeoSR-Bench dataset is currently being uploaded and reorganized.
18
 
19
+ Some files, metadata, and subsets may still be incomplete or subject to change during the upload process.
 
 
20
 
21
  ## Dataset Description
22
 
 
51
 
52
  ```text
53
  SRDatasetName/
54
+ ├── train/
55
+ │ ├── SRDatasetName_train_part_0000.parquet
56
+ │ ├── SRDatasetName_train_part_0001.parquet
57
  │ └── ...
58
+ ├── val/
59
+ │ ├── SRDatasetName_val_part_0000.parquet
60
+ │ ├── SRDatasetName_val_part_0001.parquet
61
  │ └── ...
62
+ ├── test/
63
+ │ ├── SRDatasetName_test_part_0000.parquet
64
+ │ ├── SRDatasetName_test_part_0001.parquet
65
  │ └── ...
66
+ └── index.csv
67
+ ```
68
+
69
+ Each Parquet file contains paired low-resolution and high-resolution images together with metadata:
70
+
71
+ ```text
72
+ id
73
+ lr_name
74
+ hr_name
75
+ lr_image
76
+ hr_image
77
+ meta
78
  ```
79
 
80
  ### Downstream task dataset
81
 
82
  ```text
83
  DownstreamDatasetName/
84
+ ├── train/
85
+ │ ├── DownstreamDatasetName_train_part_0000.parquet
86
+ │ ├── DownstreamDatasetName_train_part_0001.parquet
87
+ │ └── DownstreamDatasetName_train_index.csv
88
+ ├── val/
89
+ │ ├── DownstreamDatasetName_val_part_0000.parquet
90
+ │ ├── DownstreamDatasetName_val_part_0001.parquet
91
+ │ └── DownstreamDatasetName_val_index.csv
92
+ ├── test/
93
+ │ ├── DownstreamDatasetName_test_part_0000.parquet
94
+ │ ├── DownstreamDatasetName_test_part_0001.parquet
95
+ │ └── DownstreamDatasetName_test_index.csv
96
+ └── index.csv
 
 
 
 
97
  ```
98
 
99
+ Each Parquet file contains paired images, labels, and metadata:
100
 
101
+ ```text
102
+ id
103
+ lr_name
104
+ hr_name
105
+ label_name
106
+ meta_name
107
+ lr_image
108
+ hr_image
109
+ label_image
110
+ meta
111
+ ```
112
 
113
+ ## Loading Images and Labels
114
 
115
+ Images and labels are stored as binary GeoTIFF bytes inside each Parquet file. They can be read directly with `rasterio`.
116
 
117
+ ### Load an SR-only sample
 
 
 
 
 
118
 
119
+ ```python
120
+ import io
121
+ import json
122
+ import pandas as pd
123
+ import rasterio
124
 
125
+ parquet_path = "Sentinel2_to_NAIP\SR_Dataset\data\sentinel2_to_naip_part_0000.parquet"
126
 
127
+ df = pd.read_parquet(parquet_path)
128
+ sample = df.iloc[0]
 
 
 
 
129
 
130
+ with rasterio.open(io.BytesIO(sample["lr_image"])) as src:
131
+ lr = src.read()
132
+ lr_profile = src.profile
133
 
134
+ with rasterio.open(io.BytesIO(sample["hr_image"])) as src:
135
+ hr = src.read()
136
+ hr_profile = src.profile
 
137
 
138
+ meta = json.loads(sample["meta"]) if sample["meta"] is not None else None
139
 
140
+ print(sample["id"])
141
+ print(lr.shape, hr.shape)
142
+ print(meta)
143
+ ```
144
 
145
+ ### Load a downstream task sample
146
 
147
  ```python
148
+ import io
149
+ import json
150
  import pandas as pd
151
+ import rasterio
152
 
153
+ parquet_path = "Sentinel2_to_NAIP/Downstream_Datasets/RoadDetection/train/road_detection_train_part_0000.parquet"
 
154
 
155
+ df = pd.read_parquet(parquet_path)
156
+ sample = df.iloc[0]
 
157
 
158
+ with rasterio.open(io.BytesIO(sample["lr_image"])) as src:
159
+ lr = src.read()
160
+ lr_profile = src.profile
161
 
162
+ with rasterio.open(io.BytesIO(sample["hr_image"])) as src:
163
+ hr = src.read()
164
+ hr_profile = src.profile
165
 
166
+ with rasterio.open(io.BytesIO(sample["label_image"])) as src:
167
+ label = src.read()
168
+ label_profile = src.profile
169
 
170
+ meta = json.loads(sample["meta"]) if sample["meta"] is not None else None
 
171
 
172
+ print(sample["id"])
173
+ print(lr.shape, hr.shape, label.shape)
174
+ print(meta)
175
  ```
176
 
177
+ ### Convert a sample back to GeoTIFF files
178
 
179
  ```python
180
+ from pathlib import Path
181
+ import pandas as pd
182
 
183
+ parquet_path = "Sentinel2_to_NAIP/Downstream_Datasets/RoadDetection/train/road_detection_train_part_0000.parquet"
184
+ out_dir = Path("recovered_sample")
185
+ out_dir.mkdir(parents=True, exist_ok=True)
186
 
187
+ df = pd.read_parquet(parquet_path)
188
+ sample = df.iloc[0]
 
 
189
 
190
+ (out_dir / sample["lr_name"]).write_bytes(sample["lr_image"])
191
+ (out_dir / sample["hr_name"]).write_bytes(sample["hr_image"])
192
 
193
+ if "label_image" in sample:
194
+ (out_dir / sample["label_name"]).write_bytes(sample["label_image"])
 
 
 
 
 
 
 
 
 
195
  ```
196
 
197
+
198
  ## Intended Use
199
 
200
  This dataset is intended for research on: