快捷方式

Imagenette

class torchvision.datasets.Imagenette(root: ~typing.Union[str, ~pathlib.Path], split: str = 'train', size: str = 'full', download=False, transform: ~typing.Optional[~typing.Callable] = None, target_transform: ~typing.Optional[~typing.Callable] = None, loader: ~typing.Callable[[str], ~typing.Any] = <function default_loader>)[source]

Imagenette 影像分類資料集。

引數:
  • root (str 或 pathlib.Path) – Imagenette 資料集的根目錄。

  • split (string, optional) – 資料集拆分。支援 "train" (預設) 和 "val"

  • size (string, optional) – 影像大小。支援 "full" (預設)、"320px""160px"

  • download (bool, optional) – 如果為 True,則下載資料集元件並將其放置在 root 目錄中。已下載的存檔不會被再次下載。

  • transform (callable, optional) – 一個函式/變換,接收 PIL 影像或 torch.Tensor(取決於給定的載入器),並返回一個變換後的版本。例如,transforms.RandomCrop

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

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

特殊成員:

__getitem__(idx: int) tuple[Any, Any][source]
引數:

index (int) – 索引

返回:

樣本和元資料,可透過相應的變換進行可選變換。

返回型別:

(Any)

文件

訪問全面的 PyTorch 開發者文件

檢視文件

教程

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

檢視教程

資源

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

檢視資源