Table of Contents
Shortcuts

# VisionDataset

class torchvision.datasets.VisionDataset(root: str, transforms: Optional[Callable] = None, transform: Optional[Callable] = None, target_transform: Optional[Callable] = None)

  Base Class For making datasets which are compatible with torchvision. It is necessary to override the `__getitem__` and `__len__` method.

  Parameters:

    - root (string) – Root directory of dataset.

    - 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 of `transform` and `target_transform` are mutually exclusive.

## Docs

Access comprehensive developer documentation for PyTorch

View Docs

## Tutorials

Get in-depth tutorials for beginners and advanced developers

View Tutorials

## Resources

Find development resources and get your questions answered

View Resources

To analyze traffic and optimize your experience, we serve cookies on this site. By clicking or navigating, you agree to allow our usage of cookies. As the current maintainers of this site, Facebook’s Cookies Policy applies. Learn more, including about available controls: Cookies Policy.