ImageNet — Torchvision 0.22 documentation (original) (raw)

class torchvision.datasets.ImageNet(root: Union[str, Path], split: str = 'train', **kwargs: Any)[source]

ImageNet 2012 Classification Dataset.

Note

Before using this class, it is required to download ImageNet 2012 dataset fromhere and place the files ILSVRC2012_devkit_t12.tar.gz and ILSVRC2012_img_train.taror ILSVRC2012_img_val.tar based on split in the root directory.

Parameters:

Special-members:

__getitem__(index: int) → Tuple[Any, Any]

Parameters:

index (int) – Index

Returns:

(sample, target) where target is class_index of the target class.

Return type:

tuple