datasets.rst 2.1 KB
Newer Older
1
2
3
4
5
6
7
8
Datasets
========

Torchvision provides many built-in datasets in the ``torchvision.datasets``
module, as well as utility classes for building your own datasets.

Built-in datasets
~~~~~~~~~~~~~~~~~
Sasank Chilamkurthy's avatar
Sasank Chilamkurthy committed
9
10
11
12

All datasets are subclasses of :class:`torch.utils.data.Dataset`
i.e, they have ``__getitem__`` and ``__len__`` methods implemented.
Hence, they can all be passed to a :class:`torch.utils.data.DataLoader`
13
which can load multiple samples in parallel using ``torch.multiprocessing`` workers.
Sasank Chilamkurthy's avatar
Sasank Chilamkurthy committed
14
For example: ::
15

16
    imagenet_data = torchvision.datasets.ImageNet('path/to/imagenet_root/')
17
    data_loader = torch.utils.data.DataLoader(imagenet_data,
Sasank Chilamkurthy's avatar
Sasank Chilamkurthy committed
18
19
20
21
                                              batch_size=4,
                                              shuffle=True,
                                              num_workers=args.nThreads)

22
.. currentmodule:: torchvision.datasets
Sasank Chilamkurthy's avatar
Sasank Chilamkurthy committed
23
24
25

All the datasets have almost similar API. They all have two common arguments:
``transform`` and  ``target_transform`` to transform the input and target respectively.
26
You can also create your own datasets using the provided :ref:`base classes <base_classes_datasets>`.
27

28

29
30
31
32
33
34
35
36
37
38
39
40
.. autosummary::
    :toctree: generated/
    :template: class_dataset.rst

    Caltech101
    Caltech256
    CelebA
    CIFAR10
    CIFAR100
    Cityscapes
    CocoCaptions
    CocoDetection
puhuk's avatar
puhuk committed
41
    Country211
Philip Meier's avatar
Philip Meier committed
42
    DTD
43
    EMNIST
44
    EuroSAT
45
46
    FakeData
    FashionMNIST
Philip Meier's avatar
Philip Meier committed
47
    FER2013
48
49
    Flickr8k
    Flickr30k
Zhiqiang Wang's avatar
Zhiqiang Wang committed
50
    Flowers102
51
    FlyingChairs
52
    FlyingThings3D
Joao Gomes's avatar
Joao Gomes committed
53
    Food101
54
    FGVCAircraft
Sumukh Aithal's avatar
Sumukh Aithal committed
55
    GTSRB
56
    HD1K
57
58
59
60
61
    HMDB51
    ImageNet
    INaturalist
    Kinetics400
    Kitti
62
    KittiFlow
63
64
65
66
67
68
    KMNIST
    LFWPeople
    LFWPairs
    LSUN
    MNIST
    Omniglot
Philip Meier's avatar
Philip Meier committed
69
    OxfordIIITPet
70
    PCAM
71
72
73
74
75
76
    PhotoTour
    Places365
    QMNIST
    SBDataset
    SBU
    SEMEION
77
    Sintel
78
    StanfordCars
79
    STL10
Saswat Das's avatar
Saswat Das committed
80
    SUN397
81
82
83
84
85
86
    SVHN
    UCF101
    USPS
    VOCSegmentation
    VOCDetection
    WIDERFace
87
88
89
90
91
92

.. _base_classes_datasets:

Base classes for custom datasets
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

93
94
95
.. autosummary::
    :toctree: generated/
    :template: class.rst
96

97
98
99
    DatasetFolder
    ImageFolder
    VisionDataset