Update fsdkaggle2019-script.py
Browse files- fsdkaggle2019-script.py +26 -1
fsdkaggle2019-script.py
CHANGED
|
@@ -17,6 +17,15 @@ from ._fsd2019 import CLASSES
|
|
| 17 |
SAMPLE_RATE = 44_100
|
| 18 |
|
| 19 |
_TRAIN_CURATED_URL = "https://zenodo.org/records/3612637/files/FSDKaggle2019.audio_train_curated.zip"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 20 |
_TEST_URL = "https://zenodo.org/records/3612637/files/FSDKaggle2019.audio_test.zip"
|
| 21 |
_METADATA_URL = "https://zenodo.org/records/3612637/files/FSDKaggle2019.meta.zip"
|
| 22 |
|
|
@@ -44,6 +53,18 @@ class FSDKaggle2019(datasets.GeneratorBasedBuilder):
|
|
| 44 |
name="curated",
|
| 45 |
description="",
|
| 46 |
),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 47 |
]
|
| 48 |
|
| 49 |
def _info(self):
|
|
@@ -58,7 +79,11 @@ class FSDKaggle2019(datasets.GeneratorBasedBuilder):
|
|
| 58 |
|
| 59 |
def _split_generators(self, dl_manager):
|
| 60 |
"""Returns SplitGenerators."""
|
| 61 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 62 |
test_archive_path = dl_manager.download_and_extract(_TEST_URL)
|
| 63 |
metadata_archive_path = dl_manager.download_and_extract(_METADATA_URL)
|
| 64 |
|
|
|
|
| 17 |
SAMPLE_RATE = 44_100
|
| 18 |
|
| 19 |
_TRAIN_CURATED_URL = "https://zenodo.org/records/3612637/files/FSDKaggle2019.audio_train_curated.zip"
|
| 20 |
+
_TRAIN_NOISY_URLS = [
|
| 21 |
+
"https://zenodo.org/records/3612637/files/FSDKaggle2019.audio_train_noisy.z01",
|
| 22 |
+
"https://zenodo.org/records/3612637/files/FSDKaggle2019.audio_train_noisy.z02",
|
| 23 |
+
"https://zenodo.org/records/3612637/files/FSDKaggle2019.audio_train_noisy.z03",
|
| 24 |
+
"https://zenodo.org/records/3612637/files/FSDKaggle2019.audio_train_noisy.z04",
|
| 25 |
+
"https://zenodo.org/records/3612637/files/FSDKaggle2019.audio_train_noisy.z05",
|
| 26 |
+
"https://zenodo.org/records/3612637/files/FSDKaggle2019.audio_train_noisy.z06",
|
| 27 |
+
"https://zenodo.org/records/3612637/files/FSDKaggle2019.audio_train_noisy.zip"
|
| 28 |
+
]
|
| 29 |
_TEST_URL = "https://zenodo.org/records/3612637/files/FSDKaggle2019.audio_test.zip"
|
| 30 |
_METADATA_URL = "https://zenodo.org/records/3612637/files/FSDKaggle2019.meta.zip"
|
| 31 |
|
|
|
|
| 53 |
name="curated",
|
| 54 |
description="",
|
| 55 |
),
|
| 56 |
+
FSDKaggle2019Config(
|
| 57 |
+
features=datasets.Features(
|
| 58 |
+
{
|
| 59 |
+
"file": datasets.Value("string"),
|
| 60 |
+
"audio": datasets.Audio(sampling_rate=SAMPLE_RATE),
|
| 61 |
+
"sound": datasets.Sequence(datasets.Value("string")),
|
| 62 |
+
"label": datasets.Sequence(datasets.features.ClassLabel(names=CLASSES)),
|
| 63 |
+
}
|
| 64 |
+
),
|
| 65 |
+
name="noisy",
|
| 66 |
+
description="",
|
| 67 |
+
),
|
| 68 |
]
|
| 69 |
|
| 70 |
def _info(self):
|
|
|
|
| 79 |
|
| 80 |
def _split_generators(self, dl_manager):
|
| 81 |
"""Returns SplitGenerators."""
|
| 82 |
+
if self.config.name == 'curated':
|
| 83 |
+
train_archive_path = dl_manager.download_and_extract(_TRAIN_CURATED_URL)
|
| 84 |
+
elif self.config.name == 'noisy':
|
| 85 |
+
train_archive_paths = dl_manager.download(_TRAIN_NOISY_URLS)
|
| 86 |
+
assert False, f'{train_archive_paths}'
|
| 87 |
test_archive_path = dl_manager.download_and_extract(_TEST_URL)
|
| 88 |
metadata_archive_path = dl_manager.download_and_extract(_METADATA_URL)
|
| 89 |
|