update main script
Browse files
gadme.py
CHANGED
@@ -18,11 +18,11 @@ import os
|
|
18 |
import datasets
|
19 |
import pandas as pd
|
20 |
|
21 |
-
from .classes import BIRD_NAMES_NIPS4BPLUS, BIRD_NAMES_AMAZON_BASIN, BIRD_NAMES_HAWAII, \
|
22 |
BIRD_NAMES_HIGH_SIERRAS, BIRD_NAMES_SIERRA_NEVADA, BIRD_NAMES_POWDERMILL_NATURE, BIRD_NAMES_SAPSUCKER, \
|
23 |
BIRD_NAMES_COLUMBIA_COSTA_RICA, BIRD_NAMES_XENOCANTO
|
24 |
|
25 |
-
from .descriptions import _NIPS4BPLUS_CITATION, _NIPS4BPLUS_DESCRIPTION, \
|
26 |
_HIGH_SIERRAS_DESCRIPTION, _HIGH_SIERRAS_CITATION, _SIERRA_NEVADA_DESCRIPTION, _SIERRA_NEVADA_CITATION, \
|
27 |
_POWDERMILL_NATURE_DESCRIPTION, _POWDERMILL_NATURE_CITATION, _AMAZON_BASIN_DESCRIPTION, _AMAZON_BASIN_CITATION, \
|
28 |
_SAPSUCKER_WOODS_DESCRIPTION, _SAPSUCKER_WOODS_CITATION, _COLUMBIA_COSTA_RICA_CITATION, \
|
@@ -242,31 +242,38 @@ class BirdSet(datasets.GeneratorBasedBuilder):
|
|
242 |
class_list=BIRD_NAMES_COLUMBIA_COSTA_RICA,
|
243 |
),
|
244 |
BirdSetConfig(
|
245 |
-
name="
|
246 |
description=_NIPS4BPLUS_DESCRIPTION,
|
247 |
citation=_NIPS4BPLUS_CITATION,
|
248 |
-
data_dir=f"{base_url}/
|
249 |
class_list=BIRD_NAMES_NIPS4BPLUS,
|
250 |
),
|
251 |
BirdSetConfig(
|
252 |
-
name="
|
253 |
description=_NIPS4BPLUS_DESCRIPTION,
|
254 |
citation=_NIPS4BPLUS_CITATION,
|
255 |
-
data_dir=f"{base_url}/
|
256 |
class_list=BIRD_NAMES_NIPS4BPLUS,
|
257 |
),
|
258 |
BirdSetConfig(
|
259 |
-
name="
|
260 |
description=_NIPS4BPLUS_DESCRIPTION,
|
261 |
citation=_NIPS4BPLUS_CITATION,
|
262 |
-
data_dir=f"{base_url}/
|
263 |
class_list=BIRD_NAMES_NIPS4BPLUS,
|
264 |
),
|
265 |
BirdSetConfig(
|
266 |
-
name="
|
267 |
description="TODO",
|
268 |
citation="TODO",
|
269 |
-
data_dir=f"{base_url}/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
270 |
class_list=BIRD_NAMES_XENOCANTO,
|
271 |
),
|
272 |
]
|
@@ -284,16 +291,18 @@ class BirdSet(datasets.GeneratorBasedBuilder):
|
|
284 |
"NES": 12,
|
285 |
"UHH": 4,
|
286 |
"HSN": 6,
|
287 |
-
"
|
288 |
"POW": 36,
|
289 |
"SSW": 27,
|
290 |
-
"SNE": 20
|
|
|
|
|
291 |
|
292 |
test_files = {"PER": 3,
|
293 |
"NES": 8,
|
294 |
"UHH": 7,
|
295 |
"HSN": 3,
|
296 |
-
"
|
297 |
"POW": 3,
|
298 |
"SSW": 36,
|
299 |
"SNE": 5}
|
@@ -313,10 +322,10 @@ class BirdSet(datasets.GeneratorBasedBuilder):
|
|
313 |
"metadata_5s": os.path.join(self.config.data_dir, f"{ds_name}_metadata_test_5s.parquet"),
|
314 |
})
|
315 |
|
316 |
-
elif self.config.name
|
317 |
dl_dir = dl_manager.download({
|
318 |
"train": [os.path.join(self.config.data_dir, f"{ds_name}_shard_{n:04d}.tar.gz") for n in range(1, train_files[ds_name] + 1)],
|
319 |
-
"metadata": os.path.join(self.config.data_dir, f"{ds_name}
|
320 |
})
|
321 |
|
322 |
elif self.config.name in train_files.keys():
|
@@ -360,7 +369,7 @@ class BirdSet(datasets.GeneratorBasedBuilder):
|
|
360 |
"audio_archive_iterators": [dl_manager.iter_archive(archive_path) for archive_path in dl_dir["test"]],
|
361 |
"local_audio_archives_paths": local_audio_archives_paths["test"] if local_audio_archives_paths else None,
|
362 |
"metapath": dl_dir["metadata_5s"],
|
363 |
-
"split": "
|
364 |
},
|
365 |
),
|
366 |
]
|
@@ -390,7 +399,7 @@ class BirdSet(datasets.GeneratorBasedBuilder):
|
|
390 |
"audio_archive_iterators": [dl_manager.iter_archive(archive_path) for archive_path in dl_dir["test"]],
|
391 |
"local_audio_archives_paths": local_audio_archives_paths["test"] if local_audio_archives_paths else None,
|
392 |
"metapath": dl_dir["meta_test_5s"],
|
393 |
-
"split": "
|
394 |
},
|
395 |
),
|
396 |
]
|
@@ -414,9 +423,9 @@ class BirdSet(datasets.GeneratorBasedBuilder):
|
|
414 |
"end_time": row["end_time"],
|
415 |
"low_freq": row["low_freq"],
|
416 |
"high_freq": row["high_freq"],
|
417 |
-
"ebird_code": row["ebird_code"] if split != "
|
418 |
-
"ebird_code_multilabel":
|
419 |
-
"ebird_code_secondary": row.get("
|
420 |
"call_type": row["call_type"],
|
421 |
"sex": row["sex"],
|
422 |
"lat": row["lat"],
|
|
|
18 |
import datasets
|
19 |
import pandas as pd
|
20 |
|
21 |
+
from .classes import BIRD_NAMES_BIRDDB, BIRD_NAMES_NIPS4BPLUS, BIRD_NAMES_AMAZON_BASIN, BIRD_NAMES_HAWAII, \
|
22 |
BIRD_NAMES_HIGH_SIERRAS, BIRD_NAMES_SIERRA_NEVADA, BIRD_NAMES_POWDERMILL_NATURE, BIRD_NAMES_SAPSUCKER, \
|
23 |
BIRD_NAMES_COLUMBIA_COSTA_RICA, BIRD_NAMES_XENOCANTO
|
24 |
|
25 |
+
from .descriptions import _BIRD_DB_DESCRIPTION, _BIRD_DB_CITATION, _NIPS4BPLUS_CITATION, _NIPS4BPLUS_DESCRIPTION, \
|
26 |
_HIGH_SIERRAS_DESCRIPTION, _HIGH_SIERRAS_CITATION, _SIERRA_NEVADA_DESCRIPTION, _SIERRA_NEVADA_CITATION, \
|
27 |
_POWDERMILL_NATURE_DESCRIPTION, _POWDERMILL_NATURE_CITATION, _AMAZON_BASIN_DESCRIPTION, _AMAZON_BASIN_CITATION, \
|
28 |
_SAPSUCKER_WOODS_DESCRIPTION, _SAPSUCKER_WOODS_CITATION, _COLUMBIA_COSTA_RICA_CITATION, \
|
|
|
242 |
class_list=BIRD_NAMES_COLUMBIA_COSTA_RICA,
|
243 |
),
|
244 |
BirdSetConfig(
|
245 |
+
name="NBP",
|
246 |
description=_NIPS4BPLUS_DESCRIPTION,
|
247 |
citation=_NIPS4BPLUS_CITATION,
|
248 |
+
data_dir=f"{base_url}/NBP",
|
249 |
class_list=BIRD_NAMES_NIPS4BPLUS,
|
250 |
),
|
251 |
BirdSetConfig(
|
252 |
+
name="NBP_xc",
|
253 |
description=_NIPS4BPLUS_DESCRIPTION,
|
254 |
citation=_NIPS4BPLUS_CITATION,
|
255 |
+
data_dir=f"{base_url}/NBP",
|
256 |
class_list=BIRD_NAMES_NIPS4BPLUS,
|
257 |
),
|
258 |
BirdSetConfig(
|
259 |
+
name="NBP_scape",
|
260 |
description=_NIPS4BPLUS_DESCRIPTION,
|
261 |
citation=_NIPS4BPLUS_CITATION,
|
262 |
+
data_dir=f"{base_url}/NBP",
|
263 |
class_list=BIRD_NAMES_NIPS4BPLUS,
|
264 |
),
|
265 |
BirdSetConfig(
|
266 |
+
name="XCM",
|
267 |
description="TODO",
|
268 |
citation="TODO",
|
269 |
+
data_dir=f"{base_url}/XCM",
|
270 |
+
class_list=BIRD_NAMES_XENOCANTO,
|
271 |
+
),
|
272 |
+
BirdSetConfig(
|
273 |
+
name="XCL",
|
274 |
+
description="TODO",
|
275 |
+
citation="TODO",
|
276 |
+
data_dir=f"{base_url}/XCL",
|
277 |
class_list=BIRD_NAMES_XENOCANTO,
|
278 |
),
|
279 |
]
|
|
|
291 |
"NES": 12,
|
292 |
"UHH": 4,
|
293 |
"HSN": 6,
|
294 |
+
"NBP": 14,
|
295 |
"POW": 36,
|
296 |
"SSW": 27,
|
297 |
+
"SNE": 20,
|
298 |
+
"XCM": 157,
|
299 |
+
"XCL": 1}
|
300 |
|
301 |
test_files = {"PER": 3,
|
302 |
"NES": 8,
|
303 |
"UHH": 7,
|
304 |
"HSN": 3,
|
305 |
+
"NBP": 1,
|
306 |
"POW": 3,
|
307 |
"SSW": 36,
|
308 |
"SNE": 5}
|
|
|
322 |
"metadata_5s": os.path.join(self.config.data_dir, f"{ds_name}_metadata_test_5s.parquet"),
|
323 |
})
|
324 |
|
325 |
+
elif self.config.name.startswith("XC"):
|
326 |
dl_dir = dl_manager.download({
|
327 |
"train": [os.path.join(self.config.data_dir, f"{ds_name}_shard_{n:04d}.tar.gz") for n in range(1, train_files[ds_name] + 1)],
|
328 |
+
"metadata": os.path.join(self.config.data_dir, f"{ds_name}_metadata.parquet"),
|
329 |
})
|
330 |
|
331 |
elif self.config.name in train_files.keys():
|
|
|
369 |
"audio_archive_iterators": [dl_manager.iter_archive(archive_path) for archive_path in dl_dir["test"]],
|
370 |
"local_audio_archives_paths": local_audio_archives_paths["test"] if local_audio_archives_paths else None,
|
371 |
"metapath": dl_dir["metadata_5s"],
|
372 |
+
"split": "test_multilabel"
|
373 |
},
|
374 |
),
|
375 |
]
|
|
|
399 |
"audio_archive_iterators": [dl_manager.iter_archive(archive_path) for archive_path in dl_dir["test"]],
|
400 |
"local_audio_archives_paths": local_audio_archives_paths["test"] if local_audio_archives_paths else None,
|
401 |
"metapath": dl_dir["meta_test_5s"],
|
402 |
+
"split": "test_multilabel"
|
403 |
},
|
404 |
),
|
405 |
]
|
|
|
423 |
"end_time": row["end_time"],
|
424 |
"low_freq": row["low_freq"],
|
425 |
"high_freq": row["high_freq"],
|
426 |
+
"ebird_code": row["ebird_code"] if split != "test_multilabel" else None,
|
427 |
+
"ebird_code_multilabel": row.get("ebird_code_multilabel", None),
|
428 |
+
"ebird_code_secondary": row.get("ebird_code_multilabel", None),
|
429 |
"call_type": row["call_type"],
|
430 |
"sex": row["sex"],
|
431 |
"lat": row["lat"],
|