datasets.rst 3.33 KB
Newer Older
Nicolas Hug's avatar
Nicolas Hug committed
1
2
.. _datasets:

3
4
5
6
7
8
9
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
10
-----------------
Sasank Chilamkurthy's avatar
Sasank Chilamkurthy committed
11
12
13
14

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`
15
which can load multiple samples in parallel using ``torch.multiprocessing`` workers.
Sasank Chilamkurthy's avatar
Sasank Chilamkurthy committed
16
For example: ::
17

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

24
.. currentmodule:: torchvision.datasets
Sasank Chilamkurthy's avatar
Sasank Chilamkurthy committed
25
26
27

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

30
31
Image classification
~~~~~~~~~~~~~~~~~~~~
32

33
34
35
36
37
38
39
40
41
.. autosummary::
    :toctree: generated/
    :template: class_dataset.rst

    Caltech101
    Caltech256
    CelebA
    CIFAR10
    CIFAR100
puhuk's avatar
puhuk committed
42
    Country211
Philip Meier's avatar
Philip Meier committed
43
    DTD
44
    EMNIST
45
    EuroSAT
46
47
    FakeData
    FashionMNIST
Philip Meier's avatar
Philip Meier committed
48
    FER2013
49
    FGVCAircraft
50
51
    Flickr8k
    Flickr30k
Zhiqiang Wang's avatar
Zhiqiang Wang committed
52
    Flowers102
Joao Gomes's avatar
Joao Gomes committed
53
    Food101
Sumukh Aithal's avatar
Sumukh Aithal committed
54
    GTSRB
55
    INaturalist
56
    ImageNet
Philip Meier's avatar
Philip Meier committed
57
    Imagenette
58
59
60
61
62
    KMNIST
    LFWPeople
    LSUN
    MNIST
    Omniglot
Philip Meier's avatar
Philip Meier committed
63
    OxfordIIITPet
64
    Places365
65
    PCAM
66
    QMNIST
67
    RenderedSST2
68
    SEMEION
69
    SBU
70
    StanfordCars
71
    STL10
Saswat Das's avatar
Saswat Das committed
72
    SUN397
73
74
    SVHN
    USPS
75
76
77
78
79
80
81
82
83
84
85
86
87
88

Image detection or segmentation
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

.. autosummary::
    :toctree: generated/
    :template: class_dataset.rst

    CocoDetection
    CelebA
    Cityscapes
    Kitti
    OxfordIIITPet
    SBDataset
89
90
91
    VOCSegmentation
    VOCDetection
    WIDERFace
92

93
94
95
96
97
98
99
100
101
102
103
104
105
Optical Flow
~~~~~~~~~~~~

.. autosummary::
    :toctree: generated/
    :template: class_dataset.rst

    FlyingChairs
    FlyingThings3D
    HD1K
    KittiFlow
    Sintel

106
107
108
109
110
111
112
113
114
115
Stereo Matching
~~~~~~~~~~~~~~~

.. autosummary::
    :toctree: generated/
    :template: class_dataset.rst

    CarlaStereo
    Kitti2012Stereo
    Kitti2015Stereo
Ponku's avatar
Ponku committed
116
    CREStereo
Ponku's avatar
Ponku committed
117
    FallingThingsStereo
118
    SceneFlowStereo
Ponku's avatar
Ponku committed
119
    SintelStereo
Ponku's avatar
Ponku committed
120
    InStereo2k
Ponku's avatar
Ponku committed
121
    ETH3DStereo
Ponku's avatar
Ponku committed
122
    Middlebury2014Stereo
123

124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
Image pairs
~~~~~~~~~~~

.. autosummary::
    :toctree: generated/
    :template: class_dataset.rst

    LFWPairs
    PhotoTour

Image captioning
~~~~~~~~~~~~~~~~

.. autosummary::
    :toctree: generated/
    :template: class_dataset.rst

    CocoCaptions

Video classification
~~~~~~~~~~~~~~~~~~~~

.. autosummary::
    :toctree: generated/
    :template: class_dataset.rst

    HMDB51
151
    Kinetics
152
153
    UCF101

Akira Noda's avatar
Akira Noda committed
154
155
156
157
158
159
160
161
Video prediction
~~~~~~~~~~~~~~~~~~~~

.. autosummary::
    :toctree: generated/
    :template: class_dataset.rst

    MovingMNIST
162

163
164
165
.. _base_classes_datasets:

Base classes for custom datasets
166
--------------------------------
167

168
169
170
.. autosummary::
    :toctree: generated/
    :template: class.rst
171

172
173
174
    DatasetFolder
    ImageFolder
    VisionDataset
175
176
177
178
179
180
181
182
183

Transforms v2
-------------

.. autosummary::
    :toctree: generated/
    :template: function.rst

    wrap_dataset_for_transforms_v2