-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathconfig.py
62 lines (49 loc) · 1.87 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
import os
import torch
import albumentations as A
from albumentations.pytorch import ToTensorV2
class Config:
def __init__(self) -> None:
self.num_classes = 1
self.epochs = 20
self.batch_size = 64
self.dataset_dir = r'smoke_data/dataset'
self.resize = True
self.image_size = (224, 224)
self.num_workers = 4
self.pin_memory = True
self.device = 'cuda' if torch.cuda.is_available() else 'cpu'
self.model_name = 'resnet50'
self.model_path = r'saved/'+ self.model_name +'_'+str(self.image_size[0])+'x'+str(self.image_size[1])+'.pth'
self.learning_rate = 0.001
self.classification_threshold = 0.75
self.train_transform = A.Compose(
[
A.CLAHE(p=1.0),
A.Cutout(num_holes=16, max_h_size=13, max_w_size=13, fill_value=[
225, 225, 225], always_apply=False, p=0.8),
A.Flip(p=0.8),
A.RGBShift(r_shift_limit=5, g_shift_limit=5,
b_shift_limit=5, p=0.5),
A.RandomFog(fog_coef_lower=0.3, fog_coef_upper=0.7,
alpha_coef=0.2, always_apply=False, p=0.8),
A.RandomBrightnessContrast(p=0.5),
A.Normalize(mean=(0.485, 0.456, 0.406),
std=(0.229, 0.224, 0.225)),
ToTensorV2(),
]
)
self.val_transform = A.Compose(
[
A.Normalize(mean=(0.485, 0.456, 0.406),
std=(0.229, 0.224, 0.225)),
ToTensorV2(),
]
)
self.test_transform = A.Compose(
[
A.Normalize(mean=(0.485, 0.456, 0.406),
std=(0.229, 0.224, 0.225)),
ToTensorV2(),
]
)