-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
43 lines (35 loc) · 938 Bytes
/
main.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
import albumentations as A
from albumentations.pytorch import ToTensorV2
from train import *
# Define training parameters
# Size of input image
SIZE = 512
N_FOLDS = 5
N_EPOCHS = 10
BATCH_SIZE = 64
# Transforms
transforms_train = A.Compose([
A.RandomResizedCrop(height=SIZE, width=SIZE, p=1.0),
A.Flip(),
A.ShiftScaleRotate(rotate_limit=1.0, p=0.8),
# Pixels
A.OneOf([
A.IAAEmboss(p=1.0),
A.IAASharpen(p=1.0),
A.Blur(p=1.0),
], p=0.5),
# Affine
A.OneOf([
A.ElasticTransform(p=1.0),
A.IAAPiecewiseAffine(p=1.0)
], p=0.5),
A.Normalize(p=1.0),
ToTensorV2(p=1.0),
])
transforms_valid = A.Compose([
A.Resize(height=SIZE, width=SIZE, p=1.0),
A.Normalize(p=1.0),
ToTensorV2(p=1.0),
])
training_loop(N_FOLDS=N_FOLDS, N_EPOCHS=N_EPOCHS, BATCH_SIZE=BATCH_SIZE,
transforms_train=transforms_train, transforms_valid=transforms_valid)