快捷方式

STL10

class torchvision.datasets.STL10(root: Union[str, Path], split: str = 'train', folds: Optional[int] = None, transform: Optional[Callable] = None, target_transform: Optional[Callable] = None, download: bool = False)[source]

STL10 資料集。

引數:
  • root (str 或 pathlib.Path) – 資料集的根目錄,其中存在目錄 stl10_binary

  • split (字串) – 以下選項之一:{'train', 'test', 'unlabeled', 'train+unlabeled'}。根據此選項選擇資料集。

  • folds (int, 可選) – 以下選項之一:{0-9} 或 None。對於訓練,載入標準評估過程中 10 個預定義摺疊(每個摺疊 1k 樣本)中的一個。如果未傳遞值,則載入 5k 樣本。

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

  • target_transform (callable, 可選) – 一個函式/變換,接收目標並對其進行變換。

  • download (bool, 可選) – 如果為 true,則從網際網路下載資料集並將其放在根目錄中。如果資料集已下載,則不再重複下載。

特殊成員:

__getitem__(index: int) Tuple[Any, Any][source]
引數:

index (int) – 索引

返回:

(image, target),其中 target 是目標類別的索引。

返回型別:

tuple

文件

獲取 PyTorch 全面的開發者文件

檢視文件

教程

獲取面向初學者和高階開發者的深度教程

檢視教程

資源

查詢開發資源並獲得問題解答

檢視資源