datasets.rst 3.3 KB
Newer Older
1
2
3
4
5
6
7
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
8
-----------------
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
Image classification
~~~~~~~~~~~~~~~~~~~~
30

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

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

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

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

    CocoDetection
    CelebA
    Cityscapes
    Kitti
    OxfordIIITPet
    SBDataset
86
87
88
    VOCSegmentation
    VOCDetection
    WIDERFace
89

90
91
92
93
94
95
96
97
98
99
100
101
102
Optical Flow
~~~~~~~~~~~~

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

    FlyingChairs
    FlyingThings3D
    HD1K
    KittiFlow
    Sintel

103
104
105
106
107
108
109
110
111
112
Stereo Matching
~~~~~~~~~~~~~~~

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

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

121
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
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
148
    Kinetics
149
150
    UCF101

Akira Noda's avatar
Akira Noda committed
151
152
153
154
155
156
157
158
Video prediction
~~~~~~~~~~~~~~~~~~~~

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

    MovingMNIST
159

160
161
162
.. _base_classes_datasets:

Base classes for custom datasets
163
--------------------------------
164

165
166
167
.. autosummary::
    :toctree: generated/
    :template: class.rst
168

169
170
171
    DatasetFolder
    ImageFolder
    VisionDataset
172
173
174
175
176
177
178
179
180

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

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

    wrap_dataset_for_transforms_v2