-
Notifications
You must be signed in to change notification settings - Fork 3
/
config.py
70 lines (56 loc) · 1.54 KB
/
config.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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# Third party imports
import torch
from torchvision import transforms
# Device configuration
DEVICE = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
# Data preprocessing details
data_transforms = {
'train': transforms.Compose([
transforms.ToPILImage(),
transforms.Resize((224, 224)),
# transforms.RandomHorizontalFlip(),
transforms.ToTensor(),
transforms.Normalize([0.485, 0.456, 0.406], [0.229, 0.224, 0.225])
]),
'val': transforms.Compose([
transforms.ToPILImage(),
transforms.Resize((224, 224)),
transforms.ToTensor(),
transforms.Normalize([0.485, 0.456, 0.406], [0.229, 0.224, 0.225])
]),
}
data_transforms_500 = {
'train': transforms.Compose([
transforms.ToPILImage(),
transforms.Resize((500, 500)),
transforms.RandomHorizontalFlip(),
transforms.ToTensor(),
transforms.Normalize([0.485, 0.456, 0.406], [0.229, 0.224, 0.225])
]),
'val': transforms.Compose([
transforms.ToPILImage(),
transforms.Resize((500, 500)),
transforms.ToTensor(),
transforms.Normalize([0.485, 0.456, 0.406], [0.229, 0.224, 0.225])
]),
}
inv_normalize = transforms.Normalize(
mean=[-0.485/0.229, -0.456/0.224, -0.406/0.255],
std=[1/0.229, 1/0.224, 1/0.255])
# geometric transformer variables
TPS_GRID_SIZE = 3
# train related values
LR = 0.0002
TPS_LR = 0.0008
MOMENTUM = 0.2
RESUME = True
# FREEZE_EPOCHS = 1
# UNFREEZE_EPOCHS = 200
EPOCHS = 1000
PARAMS = {'batch_size': 4,
'shuffle': True,
'num_workers': 16}
PARAMS_VAL = {'batch_size': 4,
'shuffle': False,
'num_workers': 16}
EMBEDDING_SIZE = 256