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 (字串 或 列表) – {‘train’, ‘val’, ‘test’} 之一或要載入的類別列表。例如:[‘bedroom_train’, ‘church_outdoor_train’]。 transform (可呼叫物件, 可選) – 一個函式/轉換,它接收一個 PIL 影像並返回轉換後的版本。例如,transforms.RandomCrop target_transform (可呼叫物件, 可選) – 一個函式/轉換,它接收目標並對其進行轉換。 特殊成員: __getitem__(index: int) → Tuple[Any, Any][source]¶ 引數: index (int) – 索引 返回: 元組 (image, target),其中 target 是目標類別的索引。 返回型別: tuple