LSUN — Torchvision 0.22 documentation (original) (raw)
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 dataset.
You will need to install the lmdb
package to use this dataset: runpip install lmdb
Parameters:
- root (str or
pathlib.Path
) – Root directory for the database files. - classes (string or list) – One of {‘train’, ‘val’, ‘test’} or a list of categories to load. e,g. [‘bedroom_train’, ‘church_outdoor_train’].
- transform (callable , optional) – A function/transform that takes in a PIL image and returns a transformed version. E.g,
transforms.RandomCrop
- target_transform (callable , optional) – A function/transform that takes in the target and transforms it.
Special-members:
__getitem__(index: int) → Tuple[Any, Any][source]¶
Parameters:
index (int) – Index
Returns:
Tuple (image, target) where target is the index of the target category.
Return type: