快捷方式

SVHN

class torchvision.datasets.SVHN(root: Union[str, Path], split: str = 'train', transform: Optional[Callable] = None, target_transform: Optional[Callable] = None, download: bool = False)[原始碼]

SVHN 資料集。注意:SVHN 資料集將數字 0 的標籤指定為 10。但是,在此資料集中,我們將數字 0 的標籤指定為 0,以相容 PyTorch 損失函式,後者期望類別標籤在 [0, C-1] 範圍內。

警告

此類需要 scipy 來從 .mat 格式載入資料。

引數:
  • root (str 或 pathlib.Path) – 資料集根目錄,資料儲存在此處。

  • split (string) – {‘train’, ‘test’, ‘extra’} 中的一個。相應地選擇資料集。‘extra’ 是額外的訓練集。

  • transform (callable, optional) – 一個函式/變換,接受 PIL 影像並返回變換後的版本。例如,transforms.RandomCrop

  • target_transform (可呼叫物件, 可選) – 一個函式/變換,接受目標並對其進行變換。

  • download (bool, optional) – 如果為 True,則從網際網路下載資料集並將其放入根目錄。如果資料集已下載,則不會再次下載。

特殊成員:

__getitem__(index: int) tuple[Any, Any][原始碼]
引數:

index (int) – 索引

返回:

(影像, 目標) 其中目標是目標類的索引。

返回型別:

元組

文件

訪問全面的 PyTorch 開發者文件

檢視文件

教程

為初學者和高階開發者提供深入的教程

檢視教程

資源

查詢開發資源並讓您的問題得到解答

檢視資源