From 55de23d9a1e6e4c34bdf4ec6ab51baa7686d765e Mon Sep 17 00:00:00 2001 From: Alexander Richard Date: Sun, 9 Jun 2024 15:48:49 -0400 Subject: [PATCH] added download scripts --- download_blind_testset.py | 32 ++++++++++++++++++++++++++++++++ download_ears.py | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 65 insertions(+) create mode 100644 download_blind_testset.py create mode 100644 download_ears.py diff --git a/download_blind_testset.py b/download_blind_testset.py new file mode 100644 index 0000000..de8da41 --- /dev/null +++ b/download_blind_testset.py @@ -0,0 +1,32 @@ +""" +Copyright (c) Meta Platforms, Inc. and affiliates. +All rights reserved. +This source code is licensed under the license found in the +LICENSE file in the root directory of this source tree. +""" + +import os +import urllib.request +import zipfile + + +def download_file(url, filename): + with urllib.request.urlopen(url) as response: + data = response.read() + with open(filename, 'wb') as file: + file.write(data) + + +def unzip_file(zip_path, extract_to): + os.makedirs(extract_to, exist_ok=True) + with zipfile.ZipFile(zip_path, 'r') as zip_ref: + zip_ref.extractall(extract_to) + + +print("downloading blind testset (1.4GB)...") +url = "https://github.com/facebookresearch/ears_dataset/releases/download/blind_testset/blind_testset.zip" +file = f"blind_testset.zip" +download_file(url, file) +unzip_file(file, "blind_testset") +os.remove(file) + diff --git a/download_ears.py b/download_ears.py new file mode 100644 index 0000000..126d96c --- /dev/null +++ b/download_ears.py @@ -0,0 +1,33 @@ +""" +Copyright (c) Meta Platforms, Inc. and affiliates. +All rights reserved. +This source code is licensed under the license found in the +LICENSE file in the root directory of this source tree. +""" + +import os +import tqdm +import urllib.request +import zipfile + + +def download_file(url, filename): + with urllib.request.urlopen(url) as response: + data = response.read() + with open(filename, 'wb') as file: + file.write(data) + + +def unzip_file(zip_path, extract_to): + os.makedirs(extract_to, exist_ok=True) + with zipfile.ZipFile(zip_path, 'r') as zip_ref: + zip_ref.extractall(extract_to) + + +for i in tqdm.tqdm(range(1, 108), desc="download 107 speakers of EARS dataset"): + url = f"https://github.com/facebookresearch/ears_dataset/releases/download/dataset/p{i:03d}.zip" + file = f"p{i:03d}.zip" + download_file(url, file) + unzip_file(file, ".") + os.remove(file) +