-
Notifications
You must be signed in to change notification settings - Fork 1
/
cifar10.py
35 lines (27 loc) · 1.46 KB
/
cifar10.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import torchvision
import torchvision.transforms as transforms
import torchvision.datasets as datasets
# CIFAR10
def LoadDataset(batch, normalization, augmentation):
trainset = torchvision.datasets.CIFAR10(root='./data',
train=True,
download=True,
transform=augmentation)
trainloader = torch.utils.data.DataLoader(trainset,
batch_size=batch,
shuffle=True,
num_workers=2)
testset = torchvision.datasets.CIFAR10(root='./data',
train=False,
download=True,
transform=normalization)
testset, valset = torch.utils.data.random_split(testset, [7500, 2500])
valloader = torch.utils.data.DataLoader(valset,
batch_size=batch,
shuffle=False,
num_workers=2)
testloader = torch.utils.data.DataLoader(testset,
batch_size=batch,
shuffle=False,
num_workers=2)
return trainloader, valloader, testloader