This repository has been archived by the owner on Sep 22, 2024. It is now read-only.
forked from qinnzou/DeepCrack
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfig.py
66 lines (54 loc) · 1.62 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
from pprint import pprint
import os
import setproctitle
class Config:
name = 'DeepCrack_CT260_FT1'
gpu_id = '0,1,2,3'
setproctitle.setproctitle("%s" % name)
# path
train_data_path = 'data/train_example.txt'
val_data_path = 'data/test_example.txt'
checkpoint_path = 'checkpoints'
log_path = 'log'
saver_path = os.path.join(checkpoint_path, name)
max_save = 20
# visdom
vis_env = 'DeepCrack'
port = 8097
vis_train_loss_every = 40
vis_train_acc_every = 40
vis_train_img_every = 120
val_every = 200
# training
epoch = 500
pretrained_model = ''
weight_decay = 0.0000
lr_decay = 0.1
lr = 1e-3
momentum = 0.9
use_adam = True # Use Adam optimizer
train_batch_size = 8
val_batch_size = 4
test_batch_size = 4
acc_sigmoid_th = 0.5
pos_pixel_weight = 1
# checkpointer
save_format = ''
save_acc = -1
save_pos_acc = -1
def _parse(self, kwargs):
state_dict = self._state_dict()
for k, v in kwargs.items():
if k not in state_dict:
raise ValueError('UnKnown Option: "--%s"' % k)
setattr(self, k, v)
print('======user config========')
pprint(self._state_dict())
print('==========end============')
def _state_dict(self):
return {k: getattr(self, k) for k, _ in Config.__dict__.items() \
if not k.startswith('_')}
def show(self):
print('======user config========')
pprint(self._state_dict())
print('==========end============')