torchvision.datasets.CIFAR10
时间: 2023-10-14 12:19:41 浏览: 112
CIFAR-10 dataset
torchvision.datasets.CIFAR10 is a dataset class in PyTorch that provides access to the CIFAR-10 image classification dataset. CIFAR-10 consists of 60,000 32x32 color images in 10 classes, with 6,000 images per class. The dataset is divided into 50,000 training images and 10,000 testing images.
This dataset is commonly used in image classification tasks as a benchmark dataset for evaluating the performance of deep learning models. The classes in CIFAR-10 are airplane, automobile, bird, cat, deer, dog, frog, horse, ship, and truck.
To use the CIFAR-10 dataset in PyTorch, you can create an instance of the CIFAR10 class and pass in the location of the data and whether you want to use the training or testing dataset. For example:
```python
import torchvision.datasets as datasets
train_dataset = datasets.CIFAR10(root='./data', train=True, download=True)
test_dataset = datasets.CIFAR10(root='./data', train=False, download=True)
```
This will download the CIFAR-10 dataset to the './data' directory and create a CIFAR10 object for the training and testing datasets.
阅读全文