-
Notifications
You must be signed in to change notification settings - Fork 19
/
config_pst900.py
107 lines (92 loc) · 3.15 KB
/
config_pst900.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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
import os
import os.path as osp
import sys
import time
import numpy as np
from easydict import EasyDict as edict
import argparse
C = edict()
config = C
cfg = C
C.seed = 3407
remoteip = os.popen('pwd').read()
C.root_dir = os.path.abspath(os.path.join(os.getcwd(), './'))
C.abs_dir = osp.realpath(".")
# Dataset config
"""Dataset Path"""
C.dataset_name = 'PST900'
C.dataset_path = osp.join(C.root_dir, 'datasets', 'PST900_RGBT_Dataset')
C.rgb_root_folder = osp.join(C.dataset_path, 'rgb_resize')
C.rgb_format = '.png'
C.gt_root_folder = osp.join(C.dataset_path, 'labels_resize')
C.gt_format = '.png'
C.gt_transform = False
# True when label 0 is invalid, you can also modify the function _transform_gt in dataloader.RGBXDataset
# True for most dataset valid, False for MFNet(?)
C.x_root_folder = osp.join(C.dataset_path, 'thermal_resize')
C.x_format = '.png'
C.x_is_single_channel = True # True for raw depth, thermal and aolp/dolp(not aolp/dolp tri) input
C.train_source = osp.join(C.dataset_path, "train.txt")
C.eval_source = osp.join(C.dataset_path, "test.txt")
C.is_test = False
C.num_train_imgs = 597
C.num_eval_imgs = 288
C.num_classes = 5
C.class_names = ['Background', 'Extinguisher', 'Backpack', 'Hand-Drill', 'Survivor']
"""Image Config"""
C.background = 255
C.image_height = 720
C.image_width = 1280
C.norm_mean = np.array([0.485, 0.456, 0.406])
C.norm_std = np.array([0.229, 0.224, 0.225])
""" Settings for network, this would be different for each kind of model"""
C.backbone = 'sigma_tiny' # sigma_tiny / sigma_small / sigma_base
C.pretrained_model = None # do not need to change
C.decoder = 'MambaDecoder' # 'MLPDecoder'
C.decoder_embed_dim = 512
C.optimizer = 'AdamW'
"""Train Config"""
C.lr = 6e-5
C.lr_power = 0.9
C.momentum = 0.9
C.weight_decay = 0.01
C.batch_size = 8
C.nepochs = 500
C.niters_per_epoch = C.num_train_imgs // C.batch_size + 1
C.num_workers = 16
C.train_scale_array = [0.5, 0.75, 1, 1.25, 1.5, 1.75]
C.warm_up_epoch = 10
C.fix_bias = True
C.bn_eps = 1e-3
C.bn_momentum = 0.1
"""Eval Config"""
# C.eval_iter = 1
C.eval_stride_rate = 2 / 3
C.eval_scale_array = [1] # [0.75, 1, 1.25] #
C.eval_flip = False # True #
C.eval_crop_size = [720, 1280] # [height weight]
"""Store Config"""
C.checkpoint_start_epoch = 50
C.checkpoint_step = 5
"""Path Config"""
def add_path(path):
if path not in sys.path:
sys.path.insert(0, path)
add_path(osp.join(C.root_dir))
C.log_dir = osp.abspath('log_final/log_pst900/' + 'log_' + C.dataset_name + '_' + C.backbone + '_' + 'cromb_conmb_cvssdecoder')
C.tb_dir = osp.abspath(osp.join(C.log_dir, "tb"))
C.log_dir_link = C.log_dir
C.checkpoint_dir = osp.abspath(osp.join(C.log_dir, "checkpoint"))
exp_time = time.strftime('%Y_%m_%d_%H_%M_%S', time.localtime())
C.log_file = C.log_dir + '/log_' + exp_time + '.log'
C.link_log_file = C.log_file + '/log_last.log'
C.val_log_file = C.log_dir + '/val_' + exp_time + '.log'
C.link_val_log_file = C.log_dir + '/val_last.log'
if __name__ == '__main__':
print(config.nepochs)
parser = argparse.ArgumentParser()
parser.add_argument(
'-tb', '--tensorboard', default=False, action='store_true')
args = parser.parse_args()
if args.tensorboard:
open_tensorboard()