Learn practical skills, build real-world projects, and advance your career

The CIFAR10 dataset, which consists of 60000 32x32 px colour images in 10 classes.

alt
import os
import tarfile as tar
from pathlib import Path
from torchvision.datasets.utils import download_url

import torch
import torchvision
#
#Downlaod cifar10 dataset
#
url = Path("http://files.fast.ai/data")

filename = "cifar10.tgz"
root = Path("./data")

download_url(url = url/filename, root = root)
Using downloaded and verified file: data/cifar10.tgz
#
#Unzip cifar10.tgz
#
with tar.open(name = root/filename, mode = 'r:gz') as cifar10:
    cifar10.extractall(path = root)
cifar10_dir = root/"cifar10"

os.listdir(cifar10_dir)
['train', 'models', 'test', 'labels.txt']