forked from FakerYFX/FOTS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.py
60 lines (45 loc) · 1.27 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
import warnings
class DefaultConfig(object):
initial_epoch = 0
epoch_num = 30000
lr = 1e-3
decay = 5e-4
use_gpu = True
batch_size = 64
num_workers = 10
optmizer = 'RMSprop' # RMSprop,Adam # SGD, SGD
betas = (0.5,0.999)
epsilon = 1e-4
shrink_side_ratio = 0.6
shrink_ratio = 0.2
model = 'FOTS'
patience = 2
load_weights = False
lambda_inside_score_loss = 4.0
lambda_side_vertex_code_loss = 1.0
lambda_side_vertex_coord_loss = 1.0
load_model_path = "checkpoints/model.pth"
save_path = "save_model/"
total_img = 16243
validation_split_ratio = 0.1
max_train_img_size = 736
max_predict_img_size = 2400
assert max_train_img_size in [256, 384, 512, 640, 736], 'max_train_img_size must in [256~736]'
def parse(self,kwargs):
'''
update the config params
:param self:
:param kwargs:
:return:
'''
for k,v in kwargs.items():
if not hasattr(self,k):
warnings.warn("Warning:opt has not attribute ^s" %k)
setattr(self,k,v)
print('use config:')
for k,v in self.__class__.__dict__.items():
if not k.startswith('__'):
print(k,getattr(self,k))
print("end the parse!!!")
DefaultConfig.parse=parse
opt=DefaultConfig()