datasets.rst 3.32 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
57
58
59
60
61
    KMNIST
    LFWPeople
    LSUN
    MNIST
    Omniglot
Philip Meier's avatar
Philip Meier committed
62
    OxfordIIITPet
63
    Places365
64
    PCAM
65
    QMNIST
66
    RenderedSST2
67
    SEMEION
68
    SBU
69
    StanfordCars
70
    STL10
Saswat Das's avatar
Saswat Das committed
71
    SUN397
72
73
    SVHN
    USPS
74
75
76
77
78
79
80
81
82
83
84
85
86
87

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

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

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

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

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

    FlyingChairs
    FlyingThings3D
    HD1K
    KittiFlow
    Sintel

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

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

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

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
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
150
    Kinetics
151
152
    UCF101

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

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

    MovingMNIST
161

162
163
164
.. _base_classes_datasets:

Base classes for custom datasets
165
--------------------------------
166

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

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

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

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

    wrap_dataset_for_transforms_v2