datasets.rst 3.33 KB
Newer Older
limm's avatar
limm committed
1
2
3
4
5
6
7
8
9
10
.. _datasets:

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
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

limm's avatar
limm committed
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
Image classification
~~~~~~~~~~~~~~~~~~~~

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

    Caltech101
    Caltech256
    CelebA
    CIFAR10
    CIFAR100
    Country211
    DTD
    EMNIST
    EuroSAT
    FakeData
    FashionMNIST
    FER2013
    FGVCAircraft
    Flickr8k
    Flickr30k
    Flowers102
    Food101
    GTSRB
    INaturalist
    ImageNet
    Imagenette
    KMNIST
    LFWPeople
    LSUN
    MNIST
    Omniglot
    OxfordIIITPet
    Places365
    PCAM
    QMNIST
    RenderedSST2
    SEMEION
    SBU
    StanfordCars
    STL10
    SUN397
    SVHN
    USPS

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

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

    CocoDetection
    CelebA
    Cityscapes
    Kitti
    OxfordIIITPet
    SBDataset
    VOCSegmentation
    VOCDetection
    WIDERFace

Optical Flow
94
95
~~~~~~~~~~~~

limm's avatar
limm committed
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
.. autosummary::
    :toctree: generated/
    :template: class_dataset.rst

    FlyingChairs
    FlyingThings3D
    HD1K
    KittiFlow
    Sintel

Stereo Matching
~~~~~~~~~~~~~~~

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

    CarlaStereo
    Kitti2012Stereo
    Kitti2015Stereo
    CREStereo
    FallingThingsStereo
    SceneFlowStereo
    SintelStereo
    InStereo2k
    ETH3DStereo
    Middlebury2014Stereo

Image pairs
~~~~~~~~~~~
126

limm's avatar
limm committed
127
128
129
.. autosummary::
    :toctree: generated/
    :template: class_dataset.rst
130

limm's avatar
limm committed
131
132
    LFWPairs
    PhotoTour
133

limm's avatar
limm committed
134
135
Image captioning
~~~~~~~~~~~~~~~~
136

limm's avatar
limm committed
137
138
139
.. autosummary::
    :toctree: generated/
    :template: class_dataset.rst
140

limm's avatar
limm committed
141
    CocoCaptions
142

limm's avatar
limm committed
143
144
Video classification
~~~~~~~~~~~~~~~~~~~~
145

limm's avatar
limm committed
146
147
148
.. autosummary::
    :toctree: generated/
    :template: class_dataset.rst
149

limm's avatar
limm committed
150
151
152
    HMDB51
    Kinetics
    UCF101
153

limm's avatar
limm committed
154
155
Video prediction
~~~~~~~~~~~~~~~~~~~~
156

limm's avatar
limm committed
157
158
159
.. autosummary::
    :toctree: generated/
    :template: class_dataset.rst
160

limm's avatar
limm committed
161
    MovingMNIST
162
163
164
165

.. _base_classes_datasets:

Base classes for custom datasets
limm's avatar
limm committed
166
167
168
169
170
171
172
173
174
--------------------------------

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

    DatasetFolder
    ImageFolder
    VisionDataset
175

limm's avatar
limm committed
176
177
Transforms v2
-------------
178

limm's avatar
limm committed
179
180
181
.. autosummary::
    :toctree: generated/
    :template: function.rst
182

limm's avatar
limm committed
183
    wrap_dataset_for_transforms_v2