-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.py
48 lines (43 loc) · 1.04 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
import torch
from PIL import Image
import albumentations as A
from albumentations.pytorch import ToTensorV2
LOAD_MODEL = True
SAVE_MODEL = True
CHECKPOINT_GEN = "gen.pth.tar"
CHECKPOINT_DISC = "disc.pth.tar"
DEVICE = "cuda" if torch.cuda.is_available() else "cpu"
LEARNING_RATE = 1e-4
EPOCHS = 100
BATCH_SIZE = 16
NUM_WORKERS = 4
HIGH_RES = 96
LOW_RES = HIGH_RES // 4
IMG_CHANNELS = 3
BETAS = (0.9, 0.999)
highres_transform = A.Compose(
[
A.Normalize(mean=[0.5, 0.5, 0.5], std=[0.5, 0.5, 0.5]),
ToTensorV2(),
]
)
lowres_transform = A.Compose(
[
A.Resize(width=LOW_RES, height=LOW_RES, interpolation=Image.BICUBIC),
A.Normalize(mean=[0, 0, 0], std=[1, 1, 1]),
ToTensorV2(),
]
)
both_transforms = A.Compose(
[
A.RandomCrop(width=HIGH_RES, height=HIGH_RES),
A.HorizontalFlip(p=0.5),
A.RandomRotate90(p=0.5),
]
)
test_transform = A.Compose(
[
A.Normalize(mean=[0, 0, 0], std=[1, 1, 1]),
ToTensorV2(),
]
)