目录

torchaudio.datasets

所有数据集都是 i.即,它们具有 和 实现的方法。 因此,它们都可以传递给 a,后者可以使用 worker 并行加载多个样本。 例如:__getitem____len__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)

以下数据集可用:

所有数据集都有几乎相似的 API。它们都有两个常见的参数:分别转换 input 和 target。transformtarget_transform

中国 CMUARCTIC

class root: strurl: str = 'aew'folder_in_archive: str = 'ARCTIC'下载: bool = False[来源]torchaudio.datasets.CMUARCTIC

为 CMU_ARCTIC 创建 Dataset。

参数
  • rootstr) – 找到或下载数据集的目录的路径。

  • urlstroptional) – 要从中下载数据集的 URL 或要下载的数据集的类型。 (默认值:) 允许的类型值为 、 或 。"aew""aew""ahw""aup""awb""axb""bdl""clb""eey""fem""gka""jmk""ksp""ljm""lnh""rms""rxr""slp""slt"

  • folder_in_archivestroptional) – 数据集的顶级目录。(默认:"ARCTIC")

  • downloadbooloptional) – 如果在根路径中找不到数据集,是否下载数据集。(默认值:)。False

__getitem__(n: int → Tuple[torch.Tensor, int, str, str][来源]

从数据集中加载第 n 个样本。

参数

nint) – 要加载的样本的索引

返回

(waveform, sample_rate, utterance, utterance_id)

返回类型

COMMONVOICE 公司

class root: strtsv: str = 'train.tsv'url: str = 'english'folder_in_archive: str = 'CommonVoice'version: str = 'cv-corpus-4-2019-12-10'下载: bool = False[来源]torchaudio.datasets.COMMONVOICE

为 CommonVoice 创建数据集。

参数
  • rootstr) – 找到或下载数据集的目录的路径。

  • tsvstroptional) – 用于构建元数据的 tsv 文件的名称。 (默认:"train.tsv")

  • urlstr可选) – 要从中下载数据集的 URL 或 要下载的数据集。(默认值:)。 允许的语言值为 、 、 、"english""tatar""english""german""french""welsh""breton""chuvash""turkish""kyrgyz""irish""kabyle""catalan""taiwanese""slovenian""italian""dutch""hakha chin""esperanto""estonian""persian""portuguese""basque""spanish""chinese""mongolian""sakha""dhivehi""kinyarwanda""swedish""russian""indonesian""arabic""tamil""interlingua""latvian""japanese""votic""abkhaz""cantonese""romansh sursilvan"

  • folder_in_archivestroptional) – 数据集的顶级目录。

  • versionstr) – 版本字符串。(默认值:) 对于其他允许的值,请查看 https://commonvoice.mozilla.org/en/datasets"cv-corpus-4-2019-12-10"

  • downloadbooloptional) – 如果在根路径中找不到数据集,是否下载数据集。(默认值:)。False

__getitem__(n: int → Tuple[torch.张量、整数、Dict[str, str]][来源]

从数据集中加载第 n 个样本。

参数

nint) – 要加载的样本的索引

返回

(waveform, sample_rate, dictionary),其中 Dictionary 的构建位置 使用以下键从 TSV 文件中:、、、 和 .client_idpathsentenceup_votesdown_votesagegenderaccent

返回类型

GTZAN 公司

class root: strurl: str = 'http://opihi.cs.uvic.ca/sound/genres.tar.gz'folder_in_archive: str = 'genres'download: bool = Falsesubset: Optional[str] = None[来源]torchaudio.datasets.GTZAN

为 GTZAN 创建一个数据集。

注意

如果您打算使用 http://marsyas.info/downloads/datasets.html 此数据集发布结果。

参数
  • rootstr) – 找到或下载数据集的目录的路径。

  • urlstroptional) – 要从中下载数据集的 URL。 (默认:"http://opihi.cs.uvic.ca/sound/genres.tar.gz")

  • folder_in_archivestroptional) – 数据集的顶级目录。

  • downloadbooloptional) – 如果在根路径中找不到数据集,是否下载数据集。(默认值:)。False

  • subsetstroptional) (子集,可选) – 要使用的数据集子集。 、 或 之一。 如果 ,则使用整个数据集。(默认值:)。"training""validation""testing"NoneNoneNone

__getitem__(n: int → Tuple[torch.Tensor, int, str][来源]

从数据集中加载第 n 个样本。

参数

nint) – 要加载的样本的索引

返回

(waveform, sample_rate, label)

返回类型

LIBRISPEECH

root: strurl: str = 'train-clean-100'folder_in_archive: str = 'LibriSpeech'下载: bool = False[来源]torchaudio.datasets.LIBRISPEECH

为 LibriSpeech 创建数据集。

参数
  • rootstr) – 找到或下载数据集的目录的路径。

  • urlstroptional) – 要从中下载数据集的 URL, 或要下载的数据集的类型。 允许的类型值为 、 、 、 、 和 。(默认:"dev-clean""dev-other""test-clean""test-other""train-clean-100""train-clean-360""train-other-500""train-clean-100")

  • folder_in_archivestroptional) – 数据集的顶级目录。(默认:"LibriSpeech")

  • downloadbooloptional) – 如果在根路径中找不到数据集,是否下载数据集。(默认值:)。False

__getitem__(n: int → Tuple[torch.张量、int、str、int、int、int][来源]

从数据集中加载第 n 个样本。

参数

nint) – 要加载的样本的索引

返回

(waveform, sample_rate, utterance, speaker_id, chapter_id, utterance_id)

返回类型

利布里茨

root: strurl: str = 'train-clean-100'folder_in_archive: str = 'LibriTTS'下载: bool = False[来源]torchaudio.datasets.LIBRITTS

为 LibriTTS 创建一个数据集。

参数
  • rootstr) – 找到或下载数据集的目录的路径。

  • urlstroptional) – 要从中下载数据集的 URL, 或要下载的数据集的类型。 允许的类型值为 、 、 、 、 和 。(默认:"dev-clean""dev-other""test-clean""test-other""train-clean-100""train-clean-360""train-other-500""train-clean-100")

  • folder_in_archivestroptional) – 数据集的顶级目录。(默认:"LibriTTS")

  • downloadbooloptional) – 如果在根路径中找不到数据集,是否下载数据集。(默认值:)。False

__getitem__(n: int → Tuple[torch.张量、int、str、str、int、int、str][来源]

从数据集中加载第 n 个样本。

参数

nint) – 要加载的样本的索引

返回

(waveform, sample_rate, original_text, normalized_text, speaker_id, chapter_id, utterance_id)

返回类型

LJSPEECH

root: strurl: str = 'https://data.keithito.com/data/speech/LJSpeech-1.1.tar.bz2'folder_in_archive: str = 'wavs'下载: bool = False[来源]torchaudio.datasets.LJSPEECH

为 LJSpeech-1.1 创建 Dataset。

参数
  • rootstr) – 找到或下载数据集的目录的路径。

  • urlstroptional) – 要从中下载数据集的 URL。 (默认:"https://data.keithito.com/data/speech/LJSpeech-1.1.tar.bz2")

  • folder_in_archivestroptional) – 数据集的顶级目录。(默认:"wavs")

  • downloadbooloptional) – 如果在根路径中找不到数据集,是否下载数据集。(默认值:)。False

__getitem__(n: int → Tuple[torch.Tensor, int, str, str][来源]

从数据集中加载第 n 个样本。

参数

nint) – 要加载的样本的索引

返回

(waveform, sample_rate, transcript, normalized_transcript)

返回类型

语音命令

root: strurl: str = 'speech_commands_v0.02'folder_in_archive: str = 'SpeechCommands'下载: bool = False[来源]torchaudio.datasets.SPEECHCOMMANDS

为 Speech 命令创建 Dataset。

参数
  • rootstr) – 找到或下载数据集的目录的路径。

  • urlstroptional) – 要从中下载数据集的 URL, 或要下载的数据集的类型。 允许的类型值为 和 (默认值:"speech_commands_v0.01""speech_commands_v0.02""speech_commands_v0.02")

  • folder_in_archivestroptional) – 数据集的顶级目录。(默认:"SpeechCommands")

  • downloadbooloptional) – 如果在根路径中找不到数据集,是否下载数据集。(默认值:)。False

__getitem__(n: int → Tuple[torch.Tensor, int, str, str, int][来源]

从数据集中加载第 n 个样本。

参数

nint) – 要加载的样本的索引

返回

(waveform, sample_rate, label, speaker_id, utterance_number)

返回类型

特德利姆

class root: strrelease: str = 'release1'subset: str = Nonedownload: bool = Falseaudio_ext='.sph'[来源]torchaudio.datasets.TEDLIUM

为 Tedlium 创建 Dataset。它支持版本 1、2 和 3。

参数
  • rootstr) – 找到或下载数据集的目录的路径。

  • releasestroptional) – 发行版。 允许的值为 , 或 。 (默认值:)。"release1""release2""release3""release1"

  • subsetstroptional) (子集,可选) – 要使用的数据集子集。有效选项包括 、 、 对于版本 1&2,对于版本 3。默认为 或 。"train""dev""test"None"train"None

  • downloadbooloptional) – 如果在根路径中找不到数据集,是否下载数据集。(默认值:)。False

__getitem__(n: int → Tuple[torch.张量、int、str、int、int、int][来源]

从数据集中加载第 n 个样本。

参数

nint) – 要加载的样本的索引

返回

(waveform, sample_rate, transcript, talk_id, speaker_id, identifier)

返回类型

财产phoneme_dict

音素。从单词映射到音素元组。 请注意,某些单词的音素为空。

类型

dict[strtuple[str]]

VCTK

root: strurl: str = 'https://datashare.is.ed.ac.uk/bitstream/handle/10283/3443/VCTK-Corpus-0.92.zip'folder_in_archive: str = 'VCTK-Corpus'下载: bool = False下采样: bool = False转换: Any = Nonetarget_transform: Any = None)[来源]torchaudio.datasets.VCTK

创建 VCTK 数据集。

注意

参数
  • rootstr) – 找到或下载数据集的目录的路径。

  • urlstroptional) – 未使用,因为数据集不再公开可用。

  • folder_in_archivestroptional) – 数据集的顶级目录。(默认:"VCTK-Corpus")

  • downloadbooloptional) – 如果在根路径中找不到数据集,是否下载数据集。(默认值:)。 给予将导致错误,因为数据集不再是 公开可用。Falsedownload=True

  • downsamplebooloptional) (未使用)。

  • transformcallableoptional) (转换,可选) – 应用于波形的可选转换。(默认:None)

  • target_transformcallableoptional) – 对话语应用的可选转换。(默认:None)

__getitem__(n: int → Tuple[torch.Tensor, int, str, str, str][来源]

从数据集中加载第 n 个样本。

参数

nint) – 要加载的样本的索引

返回

(waveform, sample_rate, utterance, speaker_id, utterance_id)

返回类型

VCTK_092

class root: strmic_id: str = 'mic2'download: bool = Falseurl: str = 'https://datashare.is.ed.ac.uk/bitstream/handle/10283/3443/VCTK-Corpus-0.92.zip'audio_ext='.flac'[来源]torchaudio.datasets.VCTK_092

创建 VCTK 0.92 数据集

参数
  • rootstr) – 找到数据集的顶级目录的根目录。

  • mic_idstr) – 麦克风 ID。(默认:"mic1""mic2""mic2")

  • downloadbooloptional) – 如果在根路径中找不到数据集,是否下载数据集。(默认值:)。False

  • urlstroptional) – 要从中下载数据集的 URL。 (默认:"https://datashare.is.ed.ac.uk/bitstream/handle/10283/3443/VCTK-Corpus-0.92.zip")

  • audio_extstroptional) – 如果数据集转换为非默认音频格式,则为自定义音频扩展。

注意

  • 由于缺少相应的文本文件,演讲者的所有演讲都将被跳过。p315

  • 由于缺少音频文件,所有语音都将被跳过。p280mic_id="mic2"

  • 由于缺少音频文件,演讲者的一些演讲将被跳过。p362

  • 另请参见:https://datashare.is.ed.ac.uk/handle/10283/3443

__getitem__(n: int → Tuple[torch.Tensor, int, str, str, str][来源]

从数据集中加载第 n 个样本。

参数

nint) – 要加载的样本的索引

返回

(waveform, sample_rate, utterance, speaker_id, utterance_id)

返回类型

是的没有

root: strurl: str = 'http://www.openslr.org/resources/1/waves_yesno.tar.gz'folder_in_archive: str = 'waves_yesno'下载: bool = False转换: Any = Nonetarget_transform: Any = None)[来源]torchaudio.datasets.YESNO

为 YesNo 创建 Dataset。

参数
  • rootstr) – 找到或下载数据集的目录的路径。

  • urlstroptional) – 要从中下载数据集的 URL。 (默认:"http://www.openslr.org/resources/1/waves_yesno.tar.gz")

  • folder_in_archivestroptional) – 数据集的顶级目录。(默认:"waves_yesno")

  • downloadbooloptional) – 如果在根路径中找不到数据集,是否下载数据集。(默认值:)。False

  • transformcallableoptional) (转换,可选) – 应用于波形的可选转换。(默认:None)

  • target_transformcallableoptional) – 对话语应用的可选转换。(默认:None)

__getitem__(n: int → Tuple[torch.张量、整数、列表[int]][来源]

从数据集中加载第 n 个样本。

参数

nint) – 要加载的样本的索引

返回

(waveform, sample_rate, labels)

返回类型

文档

访问 PyTorch 的全面开发人员文档

查看文档

教程

获取面向初学者和高级开发人员的深入教程

查看教程

资源

查找开发资源并解答您的问题

查看资源