快捷鍵

LSUN

class torchvision.datasets.LSUN(root: Union[str, Path], classes: Union[str, List[str]] = 'train', transform: Optional[Callable] = None, target_transform: Optional[Callable] = None)[source]

LSUN 資料集。

您需要安裝 lmdb 套件才能使用此資料集:執行 pip install lmdb

參數:
  • root (str 或 pathlib.Path) – 資料庫檔案的根目錄。

  • classes (stringlist) – {‘train’, ‘val’, ‘test’} 其中之一,或要載入的類別清單。例如 [‘bedroom_train’, ‘church_outdoor_train’]。

  • transform (callable, optional) – 一個函數/轉換,它接受 PIL 圖像並傳回轉換後的版本。例如,transforms.RandomCrop

  • target_transform (callable, optional) – 一個函數/轉換,它接受目標並轉換它。

特殊成員:

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

index (int) – 索引

Returns:

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

Return type:

tuple

文件

Access comprehensive developer documentation for PyTorch

View Docs

Tutorials

Get in-depth tutorials for beginners and advanced developers

View Tutorials

Resources

Find development resources and get your questions answered

View Resources