datasets.rst 2.06 KB
Newer Older
1
2
3
4
5
6
7
8
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
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
30
31
32
33
34
35
36
37
38
39
40
.. autosummary::
    :toctree: generated/
    :template: class_dataset.rst

    Caltech101
    Caltech256
    CelebA
    CIFAR10
    CIFAR100
    Cityscapes
    CocoCaptions
    CocoDetection
puhuk's avatar
puhuk committed
41
    Country211
Philip Meier's avatar
Philip Meier committed
42
    DTD
43
44
45
    EMNIST
    FakeData
    FashionMNIST
Philip Meier's avatar
Philip Meier committed
46
    FER2013
47
48
    Flickr8k
    Flickr30k
Zhiqiang Wang's avatar
Zhiqiang Wang committed
49
    Flowers102
50
    FlyingChairs
51
    FlyingThings3D
Joao Gomes's avatar
Joao Gomes committed
52
    Food101
53
    FGVCAircraft
Sumukh Aithal's avatar
Sumukh Aithal committed
54
    GTSRB
55
    HD1K
56
57
58
59
60
    HMDB51
    ImageNet
    INaturalist
    Kinetics400
    Kitti
61
    KittiFlow
62
63
64
65
66
67
    KMNIST
    LFWPeople
    LFWPairs
    LSUN
    MNIST
    Omniglot
Philip Meier's avatar
Philip Meier committed
68
    OxfordIIITPet
69
70
71
72
73
74
    PhotoTour
    Places365
    QMNIST
    SBDataset
    SBU
    SEMEION
75
    Sintel
76
    STL10
Saswat Das's avatar
Saswat Das committed
77
    SUN397
78
79
80
81
82
83
    SVHN
    UCF101
    USPS
    VOCSegmentation
    VOCDetection
    WIDERFace
84
85
86
87
88
89

.. _base_classes_datasets:

Base classes for custom datasets
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

90
91
92
.. autosummary::
    :toctree: generated/
    :template: class.rst
93

94
95
96
    DatasetFolder
    ImageFolder
    VisionDataset