快捷方式

Omniglot

torchvision.datasets.Omniglot(root: Union[str, Path], background: bool = True, transform: Optional[Callable] = None, target_transform: Optional[Callable] = None, download: bool = False, loader: Optional[Callable[[Union[str, Path]], Any]] = None)[原始碼]

Omniglot 資料集。

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

  • background (bool, 可選) – 如果為 True,則從“背景”集建立資料集,否則從“評估”集建立。此術語由作者定義。

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

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

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

  • loader (callable, 可選) – 一個給定影像路徑載入影像的函式。預設情況下,它使用 PIL 作為影像載入器,但使用者也可以傳入 torchvision.io.decode_image 以直接將影像資料解碼為張量。

特殊成員:

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

index (int) – 索引

返回:

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

返回型別:

tuple

文件

查閱 PyTorch 的全面開發者文件

檢視文件

教程

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

檢視教程

資源

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

檢視資源