TorchVision provides more than 25 image-classification datasets covering digit recognition, natural scenes, fine-grained categories, satellite imagery, and large-scale benchmarks. Every dataset returnsDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/pytorch/vision/llms.txt
Use this file to discover all available pages before exploring further.
(image, label) tuples and integrates seamlessly with torch.utils.data.DataLoader. Most datasets support download=True for automatic setup; a few — most notably ImageNet — require manual download due to access restrictions.
download=True works for the majority of datasets. ImageNet, PCAM (manual Google Drive download), and LFW (no longer auto-downloadable) require you to obtain the files yourself and place them in the root directory before constructing the dataset.Quick Start
Standard Benchmarks
CIFAR-10 and CIFAR-100
Small 32×32 colour images from the CIFAR collection.| Dataset | Classes | Train | Test | Image size |
|---|---|---|---|---|
| CIFAR-10 | 10 | 50 000 | 10 000 | 32×32 RGB |
| CIFAR-100 | 100 | 50 000 | 10 000 | 32×32 RGB |
__getitem__ returns (PIL.Image, int).
MNIST family
Handwritten digit and character datasets, all sharing the same constructor signature.| Class | Description | Classes | Train | Test |
|---|---|---|---|---|
MNIST | Handwritten digits 0–9 | 10 | 60 000 | 10 000 |
FashionMNIST | Zalando clothing articles | 10 | 60 000 | 10 000 |
KMNIST | Japanese Kuzushiji characters | 10 | 60 000 | 10 000 |
EMNIST | Extended MNIST (letters + digits) | varies | varies | varies |
EMNIST uses a split argument instead of train:
ImageNet
The ILSVRC-2012 large-scale classification benchmark.ImageNet:
| Attribute | Description |
|---|---|
wnids | List of WordNet IDs (synset strings) |
wnid_to_idx | Maps WordNet ID → class index |
classes | List of human-readable class-name tuples |
ImageFolder / DatasetFolder
Use these when your images are already laid out in class subdirectories but don’t belong to a named benchmark. See the Datasets Overview page for full details.STL10
96×96 colour images designed for semi-supervised learning, with an additional large unlabelled pool.__getitem__ returns (PIL.Image, int). Label is -1 for unlabelled samples.
SVHN
Street View House Numbers — digit recognition in natural scene images.Requires
scipy to load .mat files. Labels are remapped from the raw format so that digit 0 has index 0 (the dataset originally encodes it as 10).Imagenette
A 10-class subset of ImageNet selected by fast.ai for rapid prototyping.Fine-Grained Recognition
Flowers102
102 flower categories photographed in the United Kingdom.Requires
scipy to parse the .mat split files.Food101
101 food categories, each with 750 training and 250 test images.GTSRB
German Traffic Sign Recognition Benchmark — 43 sign categories.DTD
Describable Textures Dataset — 47 texture categories with 10 predefined partitions.FGVCAircraft
Fine-grained recognition of aircraft variants.OxfordIIITPet
37 categories of cat and dog breeds; supports both classification and segmentation targets.Caltech101 and Caltech256
Classic multi-category object recognition datasets.Caltech101 and Caltech256 require
gdown for automatic download. Install it with pip install gdown before passing download=True.PCAM
PatchCamelyon — 327 680 histopathology patches for binary cancer classification.EuroSAT
Satellite imagery in 10 land-use / land-cover classes.ImageFolder; the dataset has no predefined split — use torch.utils.data.random_split to create train/val/test subsets.
Scene and Places
Places365
Large-scale scene recognition benchmark with 365 scene categories.SUN397
Scene Understanding Benchmark covering 397 scene types.Country211
211-class geolocation dataset released by OpenAI.Large-Scale / Specialized
INaturalist
Biodiversity observations across plants, animals, and fungi with hierarchical taxonomic labels.RenderedSST2
Sentiment classification rendered as images (positive / negative sentences).CLEVRClassification
Object-counting classification task from the CLEVR synthetic dataset.Dataset Summary Table
| Class | Splits | Classes | download=True |
|---|---|---|---|
CIFAR10 | train / test (via train bool) | 10 | ✅ |
CIFAR100 | train / test (via train bool) | 100 | ✅ |
MNIST | train / test (via train bool) | 10 | ✅ |
FashionMNIST | train / test (via train bool) | 10 | ✅ |
KMNIST | train / test (via train bool) | 10 | ✅ |
EMNIST | byclass, bymerge, balanced, letters, digits, mnist | varies | ✅ |
ImageNet | train / val | 1 000 | ❌ Manual |
ImageFolder | user-defined | user-defined | N/A |
STL10 | train / test / unlabeled / train+unlabeled | 10 (+unlabelled) | ✅ |
SVHN | train / test / extra | 10 | ✅ |
Imagenette | train / val | 10 | ✅ |
Flowers102 | train / val / test | 102 | ✅ |
Food101 | train / test | 101 | ✅ |
GTSRB | train / test | 43 | ✅ |
DTD | train / val / test | 47 | ✅ |
FGVCAircraft | train / val / trainval / test | 100 (variant) | ✅ |
OxfordIIITPet | trainval / test | 37 | ✅ |
Caltech101 | (no official split) | 101 | ✅ |
Caltech256 | (no official split) | 257 | ✅ |
PCAM | train / val / test | 2 | ❌ Manual (Google Drive) |
EuroSAT | (no official split) | 10 | ✅ |
Country211 | train / valid / test | 211 | ✅ |
INaturalist | multiple year versions | 10 000+ | ✅ |
Places365 | train-standard / train-challenge / val | 365 | ✅ |
SUN397 | (no official split) | 397 | ✅ |
RenderedSST2 | train / val / test | 2 | ✅ |
CLEVRClassification | train / val / test | 8 (object count) | ✅ |