1. 简介:
CIFAR-100 Dataset 是用于机器视觉领域的图像分类数据集,拥有 20 个大类,共计 100 个小类,其中每个小类包含 600 张图像(500 张训练图像和 100 张测试图像)并且每张图像均有一个小标签和一个大标签。对于每一张图像,他有fine_labels和coarse_labels两个标签,分别代表图像的细粒度和粗粒度标签,对应下图的classes和superclass.
该数据集由多伦多大学计算机科学系的 Alex Krizhevsky、Vinod Nair 和 Geoffrey Hinton 于 2009 年发布,相关论文有《Learning Multiple Layers of Features from Tiny Images》。
2. 下载和导入方法:
导入的代码如下:
CIFAR_PATH = "自己的路径" mean = [0.5070751592371323, 0.48654887331495095, 0.4409178433670343] std = [0.2673342858792401, 0.2564384629170883, 0.27615047132568404] num_workers= 2 def cifar100_dataset(args): transform_train = transforms.Compose([ transforms.RandomCrop(32, padding=4), transforms.RandomHorizontalFlip(), transforms.RandomRotation(15), # 数据增强 transforms.ToTensor(), transforms.Normalize(mean, std) ]) transform_test = transforms.Compose( [transforms.ToTensor(), transforms.Normalize(mean, std)]) cifar100_training = torchvision.datasets.CIFAR100(root=CIFAR_PATH, train=True, download=True, transform=transform_train) trainloader = torch.utils.data.DataLoader(cifar100_training, batch_size=args.bs, shuffle=True, num_workers=num_workers) cifar100_testing = torchvision.datasets.CIFAR100(root=CIFAR_PATH, train=False, download=True, transform=transform_test) testloader = torch.utils.data.DataLoader(cifar100_testing, batch_size=100, shuffle=False, num_workers=num_workers) return trainloader,testloader
标签:workers,transform,CIFAR,num,transforms,100,数据 From: https://www.cnblogs.com/cainiaoxuexi2017-ZYA/p/18008733