datasets.rst 2.99 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
86

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

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

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

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

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

    FlyingChairs
    FlyingThings3D
    HD1K
    KittiFlow
    Sintel

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

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

    CarlaStereo
    Kitti2012Stereo
    Kitti2015Stereo
114
    SceneFlowStereo
Ponku's avatar
Ponku committed
115
    SintelStereo
Ponku's avatar
Ponku committed
116
    InStereo2k
117

118
119
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
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
145
    Kinetics
146
147
148
149
    Kinetics400
    UCF101


150
151
152
.. _base_classes_datasets:

Base classes for custom datasets
153
--------------------------------
154

155
156
157
.. autosummary::
    :toctree: generated/
    :template: class.rst
158

159
160
161
    DatasetFolder
    ImageFolder
    VisionDataset