快捷方式

Snips

class torchaudio.datasets.Snips(root: Union[str, Path], subset: str, speakers: Optional[List[str]] = None, audio_format: str = 'mp3')[原始碼]

Snips [Coucke et al., 2018] 資料集。

引數:
  • root (str or Path) – 資料集頂層目錄所在的根目錄。

  • subset (str) – 要使用的資料集子集。選項: ["train", "valid", "test"]。

  • speakers (List[str] or None, optional) – 要包含在資料集中的說話人列表。如果為 None,則包含子集中的所有說話人。(預設值: None)

  • audio_format (str, optional) – 音訊的副檔名。選項: ["mp3", "wav"]。(預設值: "mp3")

__getitem__

Snips.__getitem__(n: int) Tuple[Tensor, int, str, str, str][原始碼]

從資料集中載入第 n 個樣本。

引數:

n (int) – 要載入樣本的索引

返回值:

Tensor

波形

int

取樣率

str

檔名

str

音訊轉錄

str

轉錄的 IOB(Inside–outside–beginning)標籤

str

音訊的意圖標籤。

返回型別:

包含以下項的元組

get_metadata

Snips.get_metadata(n: int) Tuple[str, int, str, str, str][原始碼]

獲取資料集中第 n 個樣本的元資料。返回檔案路徑而非波形,但返回的欄位與 __getitem__() 相同。

引數:

n (int) – 要載入樣本的索引。

返回值:

str

音訊路徑

int

取樣率

str

檔名

str

音訊轉錄

str

轉錄的 IOB(Inside–outside–beginning)標籤

str

音訊的意圖標籤。

返回型別:

包含以下項的元組

文件

訪問全面的 PyTorch 開發者文件

檢視文件

教程

獲取針對初學者和高階開發者的深度教程

檢視教程

資源

查詢開發資源並解答疑問

檢視資源