Merge branch 'main' of https://huggingface.co/datasets/mb23/GraySpectrogram
Browse files- GraySpectrogram.py +10 -9
GraySpectrogram.py
CHANGED
@@ -94,7 +94,7 @@ class GraySpectrogramConfig(datasets.BuilderConfig):
|
|
94 |
class GraySpectrogram(datasets.GeneratorBasedBuilder):
|
95 |
|
96 |
# データのサブセットはここで用意
|
97 |
-
|
98 |
BUILDER_CONFIGS = [
|
99 |
GraySpectrogramConfig(
|
100 |
name="data 0-200",
|
@@ -195,22 +195,23 @@ class GraySpectrogram(datasets.GeneratorBasedBuilder):
|
|
195 |
|
196 |
def _split_generators(self, dl_manager: DownloadManager):
|
197 |
|
198 |
-
|
199 |
-
|
200 |
-
|
|
|
201 |
return [
|
202 |
datasets.SplitGenerator(
|
203 |
name=datasets.Split.TRAIN,
|
204 |
gen_kwargs={
|
205 |
-
"images": dl_manager.iter_archive(
|
206 |
-
"metadata_path":
|
207 |
}
|
208 |
),
|
209 |
datasets.SplitGenerator(
|
210 |
name=datasets.Split.TEST,
|
211 |
gen_kwargs={
|
212 |
-
"images": dl_manager.iter_archive(
|
213 |
-
"metadata_path":
|
214 |
}
|
215 |
),
|
216 |
]
|
@@ -292,7 +293,7 @@ class GraySpectrogram(datasets.GeneratorBasedBuilder):
|
|
292 |
num_list = list()
|
293 |
label_list = list()
|
294 |
|
295 |
-
with open(metadata_path) as fin:
|
296 |
for line in fin:
|
297 |
data = json.loads(line)
|
298 |
file_list.append(data["file_name"])
|
|
|
94 |
class GraySpectrogram(datasets.GeneratorBasedBuilder):
|
95 |
|
96 |
# データのサブセットはここで用意
|
97 |
+
metadata_urls, data_urls = get_information()
|
98 |
BUILDER_CONFIGS = [
|
99 |
GraySpectrogramConfig(
|
100 |
name="data 0-200",
|
|
|
195 |
|
196 |
def _split_generators(self, dl_manager: DownloadManager):
|
197 |
|
198 |
+
train_metadata_path = dl_manager.download_and_extract(self.config.metadata_url["train"])
|
199 |
+
test_metadata_path = dl_manager.download_and_extract(self.config.metadata_url["test"])
|
200 |
+
train_data_path = dl_manager.download(self.config.data_url["train"])
|
201 |
+
test_data_path = dl_manager.download(self.config.data_url["test"])
|
202 |
return [
|
203 |
datasets.SplitGenerator(
|
204 |
name=datasets.Split.TRAIN,
|
205 |
gen_kwargs={
|
206 |
+
"images": dl_manager.iter_archive(train_data_path),
|
207 |
+
"metadata_path": train_metadata_path,
|
208 |
}
|
209 |
),
|
210 |
datasets.SplitGenerator(
|
211 |
name=datasets.Split.TEST,
|
212 |
gen_kwargs={
|
213 |
+
"images": dl_manager.iter_archive(test_data_path),
|
214 |
+
"metadata_path": test_metadata_path,
|
215 |
}
|
216 |
),
|
217 |
]
|
|
|
293 |
num_list = list()
|
294 |
label_list = list()
|
295 |
|
296 |
+
with open(metadata_path, encoding="utf-8") as fin:
|
297 |
for line in fin:
|
298 |
data = json.loads(line)
|
299 |
file_list.append(data["file_name"])
|