-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdata.py
28 lines (23 loc) · 908 Bytes
/
data.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
import zipfile
import os
import torchvision.transforms as transforms
# once the images are loaded, how do we pre-process them before being passed into the network
# by default, we resize the images to 64 x 64 in size
# and normalize them to mean = 0 and standard-deviation = 1 based on statistics collected from
# the training set
train_data_transforms = transforms.Compose([
transforms.Resize(224),
transforms.RandomHorizontalFlip(0.5),
transforms.RandomRotation((-30, 30)),
transforms.RandomCrop((224, 224)),
transforms.ToTensor(),
transforms.Normalize(mean=[0.485, 0.456, 0.406],
std=[0.229, 0.224, 0.225])
])
data_transforms = transforms.Compose([
transforms.Resize(224),
transforms.CenterCrop((224, 224)),
transforms.ToTensor(),
transforms.Normalize(mean=[0.485, 0.456, 0.406],
std=[0.229, 0.224, 0.225])
])