VisionDataset¶
- class torchvision.datasets.VisionDataset(root: Optional[str] = None, transforms: Optional[Callable] = None, transform: Optional[Callable] = None, target_transform: Optional[Callable] = None)[source]¶
Base Class For making datasets which are compatible with torchvision. It is necessary to override the
__getitem__
and__len__
method.- Parameters:
root (string, optional) – Root directory of dataset. Only used for __repr__.
transforms (callable, optional) – A function/transforms that takes in an image and a label and returns the transformed versions of both.
transform (callable, optional) – A function/transform that takes in an 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.
Note
transforms
and the combination oftransform
andtarget_transform
are mutually exclusive.Examples using
VisionDataset
:Transforms v2: End-to-end object detection/segmentation example
Transforms v2: End-to-end object detection/segmentation exampleHow to use CutMix and MixUp