Imagenette — Torchvision 0.22 documentation (original) (raw)
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 image classification dataset.
Parameters:
- root (str or
pathlib.Path
) – Root directory of the Imagenette dataset. - split (string , optional) – The dataset split. Supports
"train"
(default), and"val"
. - size (string , optional) – The image size. Supports
"full"
(default),"320px"
, and"160px"
. - download (bool, optional) – If
True
, downloads the dataset components and places them inroot
. Already downloaded archives are not downloaded again. - transform (callable , optional) – A function/transform that takes in a PIL image or torch.Tensor, depends on the given loader, and returns a transformed version. E.g,
transforms.RandomCrop
- target_transform (callable , optional) – A function/transform that takes in the target and transforms it.
- loader – A function to load an image given its path. By default, it uses PIL as its image loader, but users could also pass in
torchvision.io.decode_image
for decoding image data into tensors directly.
Special-members:
__getitem__(idx: int) → Tuple[Any, Any][source]¶
Parameters:
index (int) – Index
Returns:
Sample and meta data, optionally transformed by the respective transforms.
Return type:
(Any)