Silicon23 commited on
Commit
8730a7e
·
1 Parent(s): 7e13399

Added "all" config.

Browse files
Files changed (2) hide show
  1. README.md +1 -1
  2. ioai2025-athome-satellite-images.py +92 -37
README.md CHANGED
@@ -133,7 +133,7 @@ from datasets import load_dataset
133
  import numpy as np
134
 
135
  # Load 128x128 resolution data
136
- dataset = load_dataset("your-username/goes16-satellite", name="128x128")
137
 
138
  # Access a sample
139
  sample = dataset["train"][0]
 
133
  import numpy as np
134
 
135
  # Load 128x128 resolution data
136
+ dataset = load_dataset("Silicon23/ioai2025-athome-satellite-images", name="128x128")
137
 
138
  # Access a sample
139
  sample = dataset["train"][0]
ioai2025-athome-satellite-images.py CHANGED
@@ -24,22 +24,40 @@ class Goes16Dataset(datasets.GeneratorBasedBuilder):
24
  VERSION = datasets.Version("1.0.0")
25
 
26
  BUILDER_CONFIGS = [
 
 
 
 
 
27
  datasets.BuilderConfig(
28
  name="128x128",
29
  version=VERSION,
30
- description="128x128 resolution images",
31
  ),
32
  datasets.BuilderConfig(
33
  name="256x256",
34
  version=VERSION,
35
- description="256x256 resolution images",
36
  ),
37
  ]
38
 
39
- DEFAULT_CONFIG_NAME = "128x128"
40
 
41
  def _info(self):
42
- if self.config.name == "128x128":
 
 
 
 
 
 
 
 
 
 
 
 
 
43
  # For 128x128, we know the exact dimensions
44
  features = datasets.Features({
45
  "image": datasets.Sequence(datasets.Sequence(datasets.Sequence(datasets.Value("float32")))), # [16, 128, 128]
@@ -101,40 +119,77 @@ class Goes16Dataset(datasets.GeneratorBasedBuilder):
101
  # Filter metadata for the current split
102
  split_metadata = metadata[metadata['split'] == split]
103
 
104
- if self.config.name == "128x128":
105
- size = 128
106
- else: # 256x256
107
- size = 256
108
-
109
- # Filter metadata for current resolution
110
- size_metadata = split_metadata[split_metadata['size'] == size]
111
-
112
- # Get corresponding arrays
113
- X_key = f"X_{split}_{size}"
114
- Y_key = f"Y_{split}_{size}"
115
-
116
- X_data = data[X_key]
117
- Y_data = data[Y_key]
118
-
119
  example_id = 0
120
 
121
- # Generate examples using metadata
122
- for _, row in size_metadata.iterrows():
123
- ind = row['ind']
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
124
 
125
- if ind < len(X_data): # Safety check
126
- # Convert numpy arrays to lists for datasets compatibility
127
- image_array = X_data[ind].astype(np.float32)
128
- label_array = Y_data[ind].astype(np.uint8)
129
 
130
- yield example_id, {
131
- "image": image_array.tolist(), # Convert to nested list
132
- "label": label_array.tolist(), # Convert to nested list
133
- "i": int(row['i']),
134
- "j": int(row['j']),
135
- "start_time": str(row['start_time']),
136
- "end_time": str(row['end_time']),
137
- "ind": int(row['ind']),
138
- "size": int(row['size']),
139
- }
140
- example_id += 1
 
 
 
 
 
 
24
  VERSION = datasets.Version("1.0.0")
25
 
26
  BUILDER_CONFIGS = [
27
+ datasets.BuilderConfig(
28
+ name="all",
29
+ version=VERSION,
30
+ description="All resolutions combined (128x128 and 256x256 images)",
31
+ ),
32
  datasets.BuilderConfig(
33
  name="128x128",
34
  version=VERSION,
35
+ description="128x128 resolution images only",
36
  ),
37
  datasets.BuilderConfig(
38
  name="256x256",
39
  version=VERSION,
40
+ description="256x256 resolution images only",
41
  ),
42
  ]
43
 
44
+ DEFAULT_CONFIG_NAME = "all"
45
 
46
  def _info(self):
47
+ if self.config.name == "all":
48
+ # For "all" config, use flexible features that can handle both resolutions
49
+ features = datasets.Features({
50
+ "image": datasets.Sequence(datasets.Sequence(datasets.Sequence(datasets.Value("float32")))), # Variable size [16, H, W]
51
+ "label": datasets.Sequence(datasets.Sequence(datasets.Value("uint8"))), # Variable size [H, W]
52
+ "i": datasets.Value("int32"),
53
+ "j": datasets.Value("int32"),
54
+ "start_time": datasets.Value("string"),
55
+ "end_time": datasets.Value("string"),
56
+ "ind": datasets.Value("int32"),
57
+ "size": datasets.Value("int32"), # This field indicates the actual resolution
58
+ "resolution": datasets.Value("string"), # Added field to explicitly show resolution
59
+ })
60
+ elif self.config.name == "128x128":
61
  # For 128x128, we know the exact dimensions
62
  features = datasets.Features({
63
  "image": datasets.Sequence(datasets.Sequence(datasets.Sequence(datasets.Value("float32")))), # [16, 128, 128]
 
119
  # Filter metadata for the current split
120
  split_metadata = metadata[metadata['split'] == split]
121
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
122
  example_id = 0
123
 
124
+ if self.config.name == "all":
125
+ # For "all" config, load both 128x128 and 256x256 data
126
+ for size in [128, 256]:
127
+ # Filter metadata for current resolution
128
+ size_metadata = split_metadata[split_metadata['size'] == size]
129
+
130
+ # Get corresponding arrays
131
+ X_key = f"X_{split}_{size}"
132
+ Y_key = f"Y_{split}_{size}"
133
+
134
+ X_data = data[X_key]
135
+ Y_data = data[Y_key]
136
+
137
+ # Generate examples using metadata
138
+ for _, row in size_metadata.iterrows():
139
+ ind = row['ind']
140
+
141
+ if ind < len(X_data): # Safety check
142
+ # Convert numpy arrays to lists for datasets compatibility
143
+ image_array = X_data[ind].astype(np.float32)
144
+ label_array = Y_data[ind].astype(np.uint8)
145
+
146
+ yield example_id, {
147
+ "image": image_array.tolist(), # Convert to nested list
148
+ "label": label_array.tolist(), # Convert to nested list
149
+ "i": int(row['i']),
150
+ "j": int(row['j']),
151
+ "start_time": str(row['start_time']),
152
+ "end_time": str(row['end_time']),
153
+ "ind": int(row['ind']),
154
+ "size": int(row['size']),
155
+ "resolution": f"{size}x{size}", # Add explicit resolution field
156
+ }
157
+ example_id += 1
158
+
159
+ else:
160
+ # For specific resolution configs (128x128 or 256x256)
161
+ if self.config.name == "128x128":
162
+ size = 128
163
+ else: # 256x256
164
+ size = 256
165
+
166
+ # Filter metadata for current resolution
167
+ size_metadata = split_metadata[split_metadata['size'] == size]
168
+
169
+ # Get corresponding arrays
170
+ X_key = f"X_{split}_{size}"
171
+ Y_key = f"Y_{split}_{size}"
172
+
173
+ X_data = data[X_key]
174
+ Y_data = data[Y_key]
175
 
176
+ # Generate examples using metadata
177
+ for _, row in size_metadata.iterrows():
178
+ ind = row['ind']
 
179
 
180
+ if ind < len(X_data): # Safety check
181
+ # Convert numpy arrays to lists for datasets compatibility
182
+ image_array = X_data[ind].astype(np.float32)
183
+ label_array = Y_data[ind].astype(np.uint8)
184
+
185
+ yield example_id, {
186
+ "image": image_array.tolist(), # Convert to nested list
187
+ "label": label_array.tolist(), # Convert to nested list
188
+ "i": int(row['i']),
189
+ "j": int(row['j']),
190
+ "start_time": str(row['start_time']),
191
+ "end_time": str(row['end_time']),
192
+ "ind": int(row['ind']),
193
+ "size": int(row['size']),
194
+ }
195
+ example_id += 1