-
Notifications
You must be signed in to change notification settings - Fork 0
/
args.py
175 lines (153 loc) · 10.1 KB
/
args.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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
import argparse
def get_args():
parser = argparse.ArgumentParser(description='Semantic Segmentation')
parser.add_argument('--num_classes', type=int, default=19,
help='7 or 19 classes')
parser.add_argument('--lr', type=float, default=1e-4)
parser.add_argument('--train_mode', type=str, default='Domain_transfer',
help='Domain_transfer / Source_only / Warm_up / Adaptation')
parser.add_argument('--source_dataset', nargs='*', type=str, default=['gtav'],
help='a list of datasets; gtav, cityscapes, idd, mapillary')
parser.add_argument('--target_dataset', nargs='*', type=str, default=['cityscapes', 'idd', 'mapillary'],
help='a list of datasets; gtav, cityscapes, idd, mapillary')
parser.add_argument('--image_uniform_sampling', action='store_true', default=False,
help='uniformly sample images across the multiple source domains')
parser.add_argument('--val_dataset', nargs='*', type=str, default=['cityscapes', 'idd', 'mapillary'],
help='a list consists of cityscapes, idd, mapillary')
parser.add_argument('--cv', type=int, default=0,
help='cross-validation split id to use. Default # of splits set to 3 in config')
parser.add_argument('--class_uniform_pct', type=float, default=0,
help='What fraction of images is uniformly sampled')
parser.add_argument('--class_uniform_tile', type=int, default=1024,
help='tile size for class uniform sampling')
parser.add_argument('--coarse_boost_classes', type=str, default=None,
help='use coarse annotations to boost fine data with specific classes')
parser.add_argument('--img_wt_loss', action='store_true', default=False,
help='per-image class-weighted loss')
parser.add_argument('--cls_wt_loss', action='store_true', default=False,
help='class-weighted loss')
parser.add_argument('--batch_weighting', action='store_true', default=False,
help='Batch weighting for class (use nll class weighting using batch stats')
parser.add_argument('--jointwtborder', action='store_true', default=False,
help='Enable boundary label relaxation')
parser.add_argument('--strict_bdr_cls', type=str, default='',
help='Enable boundary label relaxation for specific classes')
parser.add_argument('--rlx_off_iter', type=int, default=-1,
help='Turn off border relaxation after specific epoch count')
parser.add_argument('--rescale', type=float, default=1.0,
help='Warm Restarts new learning rate ratio compared to original lr')
parser.add_argument('--repoly', type=float, default=1.5,
help='Warm Restart new poly exp')
parser.add_argument('--fp16', action='store_true', default=False,
help='Use Nvidia Apex AMP')
parser.add_argument('--local_rank', default=0, type=int,
help='parameter used by apex library')
parser.add_argument('--sgd', action='store_true', default=True)
parser.add_argument('--adam', action='store_true', default=False)
parser.add_argument('--amsgrad', action='store_true', default=False)
parser.add_argument('--freeze_trunk', action='store_true', default=False)
parser.add_argument('--hardnm', default=0, type=int,
help='0 means no aug, 1 means hard negative mining iter 1,' +
'2 means hard negative mining iter 2')
parser.add_argument('--trunk', type=str, default='resnet101',
help='trunk model, can be: resnet101 (default), resnet50')
parser.add_argument('--max_epoch', type=int, default=180)
parser.add_argument('--max_iter', type=int, default=30000)
parser.add_argument('--max_cu_epoch', type=int, default=100000,
help='Class Uniform Max Epochs')
parser.add_argument('--start_epoch', type=int, default=0)
parser.add_argument('--crop_nopad', action='store_true', default=False)
parser.add_argument('--rrotate', type=int,
default=0, help='degree of random roate')
parser.add_argument('--color_aug', type=float,
default=0.0, help='level of color augmentation')
parser.add_argument('--gblur', action='store_true', default=False,
help='Use Guassian Blur Augmentation')
parser.add_argument('--bblur', action='store_true', default=False,
help='Use Bilateral Blur Augmentation')
parser.add_argument('--lr_schedule', type=str, default='poly',
help='name of lr schedule: poly')
parser.add_argument('--poly_exp', type=float, default=0.9,
help='polynomial LR exponent')
parser.add_argument('--bs_mult', type=int, default=2,
help='Batch size for training per gpu')
parser.add_argument('--bs_mult_val', type=int, default=1,
help='Batch size for Validation per gpu')
parser.add_argument('--crop_size', type=int, default=720,
help='training crop size')
parser.add_argument('--pre_size', type=int, default=None,
help='resize image shorter edge to this before augmentation')
parser.add_argument('--scale_min', type=float, default=0.5,
help='dynamically scale training images down to this size')
parser.add_argument('--scale_max', type=float, default=2.0,
help='dynamically scale training images up to this size')
parser.add_argument('--target_scale_min', type=float, default=0.5,
help='dynamically scale training images down to this size')
parser.add_argument('--target_scale_max', type=float, default=2.0,
help='dynamically scale training images up to this size')
parser.add_argument('--weight_decay', type=float, default=5e-4)
parser.add_argument('--momentum', type=float, default=0.9)
parser.add_argument('--init', type=str, default=None)
parser.add_argument('--snapshot', type=str, default=None)
parser.add_argument('--restore_optimizer', action='store_true', default=False)
parser.add_argument('--city_mode', type=str, default='train',
help='experiment directory date name')
parser.add_argument('--date', type=str, default='default',
help='experiment directory date name')
parser.add_argument('--exp', type=str, default='default',
help='experiment directory name')
parser.add_argument('--tb_tag', type=str, default='',
help='add tag to tb dir')
parser.add_argument('--ckpt', type=str, default='logs/ckpt',
help='Save Checkpoint Point')
parser.add_argument('--tb_path', type=str, default='logs/tb',
help='Save Tensorboard Path')
parser.add_argument('--syncbn', action='store_true', default=True,
help='Use Synchronized BN')
parser.add_argument('--dump_augmentation_images', action='store_true', default=False,
help='Dump Augmentated Images for sanity check')
parser.add_argument('--test_mode', action='store_true', default=False,
help='Minimum testing to verify nothing failed, ' +
'Runs code for 1 epoch of train and val')
parser.add_argument('-wb', '--wt_bound', type=float, default=1.0,
help='Weight Scaling for the losses')
parser.add_argument('--maxSkip', type=int, default=0,
help='Skip x number of frames of video augmented dataset')
parser.add_argument('--scf', action='store_true', default=False,
help='scale correction factor')
parser.add_argument('--dist_url', default='tcp://127.0.0.1:', type=str,
help='url used to set up distributed training')
parser.add_argument('--relax_denom', type=float, default=2.0)
parser.add_argument('--clusters', type=int, default=50)
parser.add_argument('--trials', type=int, default=10)
parser.add_argument('--dynamic', action='store_true', default=False)
parser.add_argument('--image_in', action='store_true', default=False,
help='Input Image Instance Norm')
parser.add_argument('--ema', action='store_true', default=False)
parser.add_argument('--ema_update_iter', type=int, default=300)
parser.add_argument('--rce', action='store_true', default=True)
# Domain Transfer
parser.add_argument('--DT_source_dataset', nargs='*', type=str, default=[],
help='a list of datasets; gtav, cityscapes, idd, mapillary')
parser.add_argument('--DT_target_dataset', nargs='*', type=str, default=[],
help='a list of datasets; gtav, cityscapes, idd, mapillary')
parser.add_argument('--DT_snapshot', type=str, default=None)
parser.add_argument('--mtdt_feat_ch', type=int, default=64)
# AdaptSeg
parser.add_argument('--discriminator', type=str, default=None,
help='base / FPSE')
# Augmentation
parser.add_argument('--mix_mode', type=str, default=None,
help='uniform / random / class_dist / class_dist_relation')
# Self training
parser.add_argument('--self_training', type=str, default=None)
parser.add_argument('--feat_ch', type=int, default=256)
parser.add_argument('--curriculum', action='store_true', default=False)
parser.add_argument('--initial_ratio', type=float, default=0.0)
parser.add_argument('--incremental_ratio', type=float, default=0.03)
# Tensorboard visalize
parser.add_argument('--tensorboard_visualize', action='store_true', default=False)
# If you have GPU with less than 32G memory, use following option:
parser.add_argument('--insufficient_gpu_memory', action='store_true', default=False)
args = parser.parse_args()
return parser, args