|
--- |
|
task_categories: |
|
- image-classification |
|
size_categories: |
|
- 100K<n<1M |
|
--- |
|
|
|
[CINIC10](https://github.com/BayesWatch/cinic-10) dataset with interface of [CIFAR10](https://github.com/pytorch/vision/blob/main/torchvision/datasets/cifar.py). |
|
|
|
It is faster than the common CINIC10 due to the fact that all images are loaded into RAM while initing dataset instance. |
|
|
|
|
|
You should save `cinic10.py` from this repo in local directory. And then import the CINIC10 class from it: |
|
|
|
``` |
|
import torchvision |
|
import torch |
|
from torchvision transforms |
|
from cinic10 import CINIC10 |
|
|
|
data_mean = [0.47889522, 0.47227842, 0.43047404] |
|
data_std = [0.24205776, 0.23828046, 0.25874835] |
|
|
|
transform_train = transforms.Compose([ |
|
transforms.RandomCrop(32, padding=4), |
|
transforms.Resize(32), |
|
transforms.RandomHorizontalFlip(), |
|
transforms.ToTensor(), |
|
transforms.Normalize(data_mean, data_std), |
|
]) |
|
|
|
transform_test = transforms.Compose([ |
|
transforms.Resize(32), |
|
transforms.ToTensor(), |
|
transforms.Normalize(data_mean, data_std), |
|
]) |
|
|
|
batch_size = 64 |
|
num_workers = 4 |
|
|
|
trainset = CINIC10(root='./data', train=True, download=True, transform=transform_train) |
|
trainloader = torch.utils.data.DataLoader(trainset, batch_size=batch_size, shuffle=True, num_workers=num_workers) |
|
|
|
testset = CINIC10(root='./data', train=False, download=True, transform=transform_test) |
|
testloader = torch.utils.data.DataLoader(testset, batch_size=batch_size, shuffle=False, num_workers=num_workers) |
|
|
|
``` |
|
|
|
|
|
|