-
Notifications
You must be signed in to change notification settings - Fork 0
/
dataset.py
55 lines (51 loc) · 1.39 KB
/
dataset.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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
from torchvision import datasets, transforms
from utils.augmentations import CIFAR10Policy
data_path = './data'
augmentations = []
augmentations += [CIFAR10Policy()]
augmentations += [
transforms.RandomCrop(32, padding=4),
transforms.RandomHorizontalFlip(),
transforms.ToTensor(),
transforms.Normalize(
(0.4915, 0.4823, 0.4468),
(0.2470, 0.2435, 0.2616)
)
]
cifar10 = datasets.CIFAR10(
data_path, train=True, download=True,
transform=transforms.Compose(augmentations)
)
cifar10_val = datasets.CIFAR10(
data_path, train=False, download=True,
transform=transforms.Compose([
transforms.ToTensor(),
transforms.Normalize(
(0.4915, 0.4823, 0.4468),
(0.2470, 0.2435, 0.2616)
)
])
)
cifar100 = datasets.CIFAR100(
data_path,train=True,download=True,
transform = transforms.Compose([
CIFAR10Policy(),
transforms.RandomCrop(32, padding=4),
transforms.RandomHorizontalFlip(),
transforms.ToTensor(),
transforms.Normalize(
(0.5071, 0.4867, 0.4408),
(0.2675, 0.2565, 0.2761)
)
])
)
cifar100_val = datasets.CIFAR100(
data_path,train=False,download=True,
transform = transforms.Compose([
transforms.ToTensor(),
transforms.Normalize(
(0.5071, 0.4867, 0.4408),
(0.2675, 0.2565, 0.2761)
)
])
)