torchaudio.datasets¶
所有数据集都是 torch.utils.data.Dataset 的子类,并实现了 __getitem__ 和 __len__ 方法。因此,它们都可以传递给 torch.utils.data.DataLoader,该加载器可以使用 torch.multiprocessing 个工作进程并行加载多个样本。例如:
yesno_data = torchaudio.datasets.YESNO('.', download=True)
data_loader = torch.utils.data.DataLoader(yesno_data,
batch_size=1,
shuffle=True,
num_workers=args.nThreads)
CMUARCTIC¶
-
class
torchaudio.datasets.CMUARCTIC(root: Union[str, pathlib.Path], url: str = 'aew', folder_in_archive: str = 'ARCTIC', download: bool = False)[source]¶ 为 CMU ARCTIC 创建数据集 [1]。
- Parameters
root (str 或 Path) – 数据集所在或下载的目录路径。
url (str, optional) – 要从中下载数据集的 URL,或要下载的数据集类型。 (默认值:
"aew") 允许的类型值为"aew"、"ahw"、"aup"、"awb"、"axb"、"bdl"、"clb"、"eey"、"fem"、"gka"、"jmk"、"ksp"、"ljm"、"lnh"、"rms"、"rxr"、"slp"或"slt"。folder_in_archive (str, optional) – 数据集的顶层目录。(默认值:
"ARCTIC")download (bool, optional) – 如果在根路径下未找到数据集,是否下载该数据集。(默认值:
False)。
CMUDict¶
-
class
torchaudio.datasets.CMUDict(root: Union[str, pathlib.Path], exclude_punctuations: bool = True, *, download: bool = False, url: str = 'http://svn.code.sf.net/p/cmusphinx/code/trunk/cmudict/cmudict-0.7b', url_symbols: str = 'http://svn.code.sf.net/p/cmusphinx/code/trunk/cmudict/cmudict-0.7b.symbols')[source]¶ 为 CMU 发音词典 [2] (CMUDict) 创建数据集。
- Parameters
root (str 或 Path) – 数据集所在或下载的目录路径。
exclude_punctuations (bool, optional) – 启用时,排除标点符号的发音,例如 !EXCLAMATION-POINT 和 #HASH-MARK。
download (bool, optional) – 如果在根路径下未找到数据集,是否下载该数据集。(默认值:
False)。url (str, optional) – 要从中下载字典的 URL。 (默认值:
"http://svn.code.sf.net/p/cmusphinx/code/trunk/cmudict/cmudict-0.7b")url_symbols (str, optional) – 用于下载符号列表的 URL。 (默认值:
"http://svn.code.sf.net/p/cmusphinx/code/trunk/cmudict/cmudict-0.7b.symbols")
COMMONVOICE¶
GTZAN¶
-
class
torchaudio.datasets.GTZAN(root: Union[str, pathlib.Path], url: str = 'http://opihi.cs.uvic.ca/sound/genres.tar.gz', folder_in_archive: str = 'genres', download: bool = False, subset: Optional[str] = None)[source]¶ 为 GTZAN 创建数据集 [4]。
注意
如果您计划使用此数据集发布结果,请参阅 http://marsyas.info/downloads/datasets.html。
- Parameters
root (str 或 Path) – 数据集所在或下载的目录路径。
url (str, optional) – 下载数据集的 URL。 (默认值:
"http://opihi.cs.uvic.ca/sound/genres.tar.gz")folder_in_archive (str, optional) – 数据集的顶层目录。
download (bool, optional) – 如果在根路径下未找到数据集,是否下载该数据集。(默认值:
False)。subset (str 或 None, 可选) – 要使用的数据集子集。 可以是
"training"、"validation"、"testing"或None之一。 如果为None,则使用整个数据集。(默认值:None)。
LibriMix¶
-
class
torchaudio.datasets.LibriMix(root: Union[str, pathlib.Path], subset: str = 'train-360', num_speakers: int = 2, sample_rate: int = 8000, task: str = 'sep_clean')[source]¶ 创建 LibriMix [5] 数据集。
- Parameters
root (str 或 Path) – 存储目录
Libri2Mix或Libri3Mix的目录路径。subset (str, optional) – 要使用的子集。选项:[
train-360,train-100,dev, 和test](默认:train-360)。num_speakers (int, optional) – 说话人的数量,用于确定要遍历的目录。数据集将遍历
s1到sN个目录以收集 N 个源音频。(默认值:2)sample_rate (int, optional) – 音频文件的采样率。
sample_rate决定了从哪个子目录获取音频。如果任何音频的采样率不同,则抛出ValueError。选项:[8000, 16000](默认值:8000)task (str, optional) – LibriMix 的任务。 选项:[
enh_single,enh_both,sep_clean,sep_noisy] (默认值:sep_clean)
注意
LibriMix 数据集需要手动生成。请查看 https://github.com/JorisCos/LibriMix
-
__getitem__(key: int) → Tuple[int, torch.Tensor, List[torch.Tensor]][source]¶ 从数据集中加载第 n 个样本。 :param key: 要加载的样本的索引 :type key: int
- Returns
(sample_rate, mix_waveform, list_of_source_waveforms)- Return type
(整数, 张量, 张量列表)
LIBRISPEECH¶
-
class
torchaudio.datasets.LIBRISPEECH(root: Union[str, pathlib.Path], url: str = 'train-clean-100', folder_in_archive: str = 'LibriSpeech', download: bool = False)[source]¶ 为 LibriSpeech 创建数据集 [6]。
- Parameters
root (str 或 Path) – 数据集所在或下载的目录路径。
url (str, optional) – 用于下载数据集的 URL, 或要下载的数据集类型。 允许的类型值为
"dev-clean"、"dev-other"、"test-clean"、"test-other"、"train-clean-100"、"train-clean-360"和"train-other-500"。(默认值:"train-clean-100")folder_in_archive (str, optional) – 数据集的顶层目录。(默认值:
"LibriSpeech")download (bool, optional) – 如果在根路径下未找到数据集,是否下载该数据集。(默认值:
False)。
LibriLightLimited¶
LIBRITTS¶
-
class
torchaudio.datasets.LIBRITTS(root: Union[str, pathlib.Path], url: str = 'train-clean-100', folder_in_archive: str = 'LibriTTS', download: bool = False)[source]¶ 为 LibriTTS 创建数据集 [7]。
- Parameters
root (str 或 Path) – 数据集所在或下载的目录路径。
url (str, optional) – 用于下载数据集的 URL, 或要下载的数据集类型。 允许的类型值为
"dev-clean"、"dev-other"、"test-clean"、"test-other"、"train-clean-100"、"train-clean-360"和"train-other-500"。(默认值:"train-clean-100")folder_in_archive (str, optional) – 数据集的顶层目录。(默认值:
"LibriTTS")download (bool, optional) – 如果在根路径下未找到数据集,是否下载该数据集。(默认值:
False)。
LJSPEECH¶
SPEECHCOMMANDS¶
-
class
torchaudio.datasets.SPEECHCOMMANDS(root: Union[str, pathlib.Path], url: str = 'speech_commands_v0.02', folder_in_archive: str = 'SpeechCommands', download: bool = False, subset: Optional[str] = None)[source]¶ 为 Speech Commands 创建数据集 [9]。
- Parameters
root (str 或 Path) – 数据集所在或下载的目录路径。
url (str, optional) – 用于下载数据集的 URL,或要下载的数据集类型。允许的 type 值为
"speech_commands_v0.01"和"speech_commands_v0.02"(默认值:"speech_commands_v0.02")folder_in_archive (str, optional) – 数据集的顶层目录。(默认值:
"SpeechCommands")download (bool, optional) – 如果在根路径下未找到数据集,是否下载该数据集。(默认值:
False)。subset (str 或 None, 可选) – 选择数据集的子集 [None, “training”, “validation”, “testing”]。None 表示整个数据集。“validation”和“testing”分别在“validation_list.txt”和"testing_list.txt”中定义,而“training”则是其余部分。关于文件“validation_list.txt”和"testing_list.txt”的详细信息在数据集的 README 以及原始论文第 7 节的介绍及其参考文献 12 中有说明。原始论文可在 此处 找到。(默认值:
None)
TEDLIUM¶
-
class
torchaudio.datasets.TEDLIUM(root: Union[str, pathlib.Path], release: str = 'release1', subset: str = 'train', download: bool = False, audio_ext: str = '.sph')[source]¶ 为 Tedlium 创建数据集 [10]。它支持第 1、2 和 3 版。
- Parameters
root (str 或 Path) – 数据集所在或下载的目录路径。
release (str, optional) – 发布版本。 允许的值是
"release1"、"release2"或"release3"。 (默认值:"release1")。subset (str, optional) – 要使用的数据集子集。有效选项为
"train"、"dev"和"test"。默认为"train"。download (bool, optional) – 如果在根路径下未找到数据集,是否下载该数据集。(默认值:
False)。audio_ext (str, optional) – 音频文件的扩展名(默认值:
".sph")
VCTK_092¶
-
class
torchaudio.datasets.VCTK_092(root: str, mic_id: str = 'mic2', download: bool = False, url: str = 'https://datashare.is.ed.ac.uk/bitstream/handle/10283/3443/VCTK-Corpus-0.92.zip', audio_ext='.flac')[source]¶ 创建 VCTK 0.92 [11] 数据集
- Parameters
root (str) – 找到数据集顶级目录的根目录。
mic_id (str, optional) – 麦克风 ID。可以是
"mic1"或"mic2"。(默认值:"mic2")download (bool, optional) – 如果在根路径下未找到数据集,是否下载该数据集。(默认值:
False)。url (str, optional) – 下载数据集的 URL。 (默认值:
"https://datashare.is.ed.ac.uk/bitstream/handle/10283/3443/VCTK-Corpus-0.92.zip")audio_ext (str, optional) – 如果数据集转换为非默认音频格式,则使用自定义音频扩展。
注意
由于缺少相应的文本文件,将跳过演讲者
p315的所有演讲。由于缺少音频文件,
p280的所有演讲将被跳过mic_id="mic2"。由于缺少音频文件,说话人
p362的部分演讲将被跳过。
DR_VCTK¶
-
class
torchaudio.datasets.DR_VCTK(root: Union[str, pathlib.Path], subset: str = 'train', *, download: bool = False, url: str = 'https://datashare.ed.ac.uk/bitstream/handle/10283/3038/DR-VCTK.zip')[source]¶ 为 设备录制 VCTK(小数据集版本) 创建数据集 [12]。
- Parameters
YESNO¶
QUESST14¶
参考文献¶
- 1
John Kominek, Alan W Black, 和 Ver Ver. CMU Arctic 数据库用于语音合成。技术报告,2003年。
- 2
R.L. Weide. 卡内基梅隆发音词典. 1998. URL: http://www.speech.cs.cmu.edu/cgi-bin/cmudict.
- 3
Rosana Ardila, Megan Branson, Kelly Davis, Michael Henretty, Michael Kohler, Josh Meyer, Reuben Morais, Lindsay Saunders, Francis M. Tyers, 和 Gregor Weber。Common voice: 一个大规模多语言语音语料库。2020。 arXiv:1912.06670.
- 4
George Tzanetakis, Georg Essl, 和 Perry Cook。音频信号的自动音乐流派分类。2001年。网址:http://ismir2001.ismir.net/pdf/tzanetakis.pdf。
- 5
Joris Cosentino, Manuel Pariente, Samuele Cornell, Antoine Deleforge, 和 Emmanuel Vincent. Librimix: 一个用于可推广语音分离的开源数据集。2020. arXiv:2005.11262.
- 6
Vassil Panayotov, Guoguo Chen, Daniel Povey, 和 Sanjeev Khudanpur。Librispeech:一个基于公共领域有声书的语音识别语料库。在 2015 IEEE 国际声学、语音与信号处理会议(ICASSP),卷,5206–5210。2015。 doi:10.1109/ICASSP.2015.7178964.
- 7
Heiga Zen, Viet-Trung Dang, Robert A. J. Clark, Yu Zhang, Ron J. Weiss, Ye Jia, Z. Chen, and Yonghui Wu. Libritts: 一个源自LibriSpeech的文本到语音语料库。 ArXiv, 2019.
- 8
Keith Ito 和 Linda Johnson。The lj speech dataset。https://keithito.com/LJ-Speech-Dataset/,2017。
- 9
P. Warden. 语音指令:一个有限词汇量语音识别数据集。 ArXiv e-prints, 2018年4月。URL: https://arxiv.org/abs/1804.03209, arXiv:1804.03209.
- 10
Anthony Rousseau, Paul Deléglise, 和 Yannick Estève. Ted-lium: 一个专用的自动语音识别语料库。在 语言资源与评估会议(LREC) 中,125–129。2012年。
- 11
Junichi Yamagishi, Christophe Veaux, 和 Kirsten MacDonald。CSTR VCTK语料库:用于CSTR语音克隆工具包的英语多说话人语料库(版本0.92)。2019年。 doi:10.7488/ds/2645.
- 12
Seyyed Saeed Sarfjoo 和 Junichi Yamagishi. Device recorded vctk(小规模子集版本)。2018.
- 13
Yesno. URL: http://www.openslr.org/1/.
- 14
Xavier Anguera Miro, Luis Javier Rodriguez-Fuentes, Andi Buzo, Florian Metze, Igor Szoke, 和 Mikel Peñagarikano. Quesst2014: 在真实查询中评估零资源设置下的示例查询语音搜索。 2015 IEEE 国际声学、语音与信号处理会议(ICASSP), 第 5833–5837 页, 2015.