-
Notifications
You must be signed in to change notification settings - Fork 18
/
options.py
306 lines (270 loc) · 14.9 KB
/
options.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
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
# Copyright Niantic 2019. Patent Pending. All rights reserved.
#
# This software is licensed under the terms of the Monodepth2 licence
# which allows for non-commercial use only, the full terms of which are made
# available in the LICENSE file.
import configargparse
class MonodepthOptions:
def __init__(self):
self.parser = configargparse.ArgumentParser()
self.parser.add_argument('--config', is_config_file=True,
help='config file path')
self.parser.add_argument("--debug", action="store_true")
self.parser.add_argument("--eval_only",
help="if set, only evaluation",
action="store_true")
self.parser.add_argument("--local_rank", default=0, type=int)
# paths
self.parser.add_argument("--dataroot",
type=str,
help="the root for the ddad and nuscenes dataset",
default='data/nuscenes')
self.parser.add_argument("--model_name",
type=str,
help="the name of the folder to save the model in",
default="nusc-depth")
self.parser.add_argument("--log_dir",
type=str,
help="log directory",
default='logs')
# method options
self.parser.add_argument("--volume_depth",
action="store_true",
help="if set, using the depth from volume rendering, rather than the depthdecoder")
self.parser.add_argument("--voxels_size",
type=int, nargs='+',
default=[24, 300, 300],
help='the resolution of the voxel for rendering: Z, Y, X = 24, 300, 300')
self.parser.add_argument("--real_size",
type=float, nargs='+',
default=[-40, 40, -40, 40, -1, 5.4],
help='the real scale of the voxel: XMIN, XMAX, ZMIN, ZMAX, YMIN, YMAX')
self.parser.add_argument("--self_supervise",
action="store_true",
help="if set, using the self-supervised mothod")
self.parser.add_argument("--eval_occ",
action="store_true",
help="if set, eval the occupancy score")
self.parser.add_argument("--contracted_coord",
action="store_true",
help="if set, using the contracted coordinate")
self.parser.add_argument("--contracted_ratio",
type=float, default=0.8,
help="the threshold for the contracted coordinate")
self.parser.add_argument("--infinite_range",
action="store_true",
help="sampling strategy for contracted coordinate")
self.parser.add_argument("--auxiliary_frame",
action="store_true",
help="if set, using auxiliary images")
self.parser.add_argument("--use_semantic",
help="if set, use semantic segmentation for training",
action="store_true")
self.parser.add_argument("--semantic_classes",
type=int, default=17,
help="the output channel of the semantic_head")
self.parser.add_argument("--class_frequencies",
nargs="+", type=int,
default= [0, 18164955800, 734218842, 2336187448, 10996756106, 395414611,
638889260, 651023279, 117046208, 985341947, 7303776233, 43131984997,
0, 9342674867, 9525824742, 51204832885, 22848065525, 31841090018])
self.parser.add_argument("--semantic_sample_ratio",
type=float, default=0.25,
help="sample less points for semantic to accelerate the training")
self.parser.add_argument("--last_free",
action="store_true",
help="if the last class is free space")
# DATASET options
self.parser.add_argument("--dataset",
type=str,
help="dataset to train on",
default="nusc")
self.parser.add_argument("--cam_N",
type=int,
help="THE NUM OF CAM",
default=6)
self.parser.add_argument("--use_fix_mask",
help="if set, use self-occlusion mask (only for DDAD)",
action="store_true")
# OPTIMIZATION options
self.parser.add_argument("--use_fp16",
action="store_true",
help="if set, using mixed precision training")
self.parser.add_argument("--batch_size",
type=int,
help="batch size",
default=6)
self.parser.add_argument("--B",
type=int,
help="real batch size",
default=1)
self.parser.add_argument("--learning_rate",
type=float,
help="learning rate",
default=1e-4)
self.parser.add_argument("--weight_decay",
type=float,
help="weight decay",
default=0.0)
self.parser.add_argument("--num_epochs",
type=int,
help="number of epochs",
default=12)
self.parser.add_argument("--scheduler_step_size",
type=int,
help="step size of the scheduler",
default=10)
# DEPTH ESTIMATION options
self.parser.add_argument("--frame_ids",
nargs="+",
type=int,
help="frames to load, currently only support for 3 frames",
default=[0, -1, 1])
self.parser.add_argument("--v1_multiscale",
help="if set, uses monodepth v1 multiscale",
action="store_true")
self.parser.add_argument("--avg_reprojection",
help="if set, uses average reprojection loss",
action="store_true")
self.parser.add_argument("--disable_automasking",
help="if set, doesn't do auto-masking",
action="store_true")
self.parser.add_argument("--predictive_mask",
help="if set, uses a predictive masking scheme as in Zhou et al",
action="store_true")
self.parser.add_argument("--no_ssim",
help="if set, disables ssim in the loss",
action="store_true")
self.parser.add_argument("--weights_init",
type=str,
help="pretrained or scratch",
default="pretrained",
choices=["pretrained", "scratch"])
self.parser.add_argument("--scales",
type=int, nargs="+",
help="scales used in the loss",
default=[0])
# self.parser.add_argument("--pose_model_input",
# type=str,
# help="how many images the pose network gets",
# default="pairs",
# choices=["pairs", "all"])
# self.parser.add_argument("--pose_model_type",
# type=str,
# help="normal or shared",
# default="separate_resnet")
# SYSTEM options
self.parser.add_argument("--num_workers",
type=int,
help="number of dataloader workers",
default=4)
# LOADING options
self.parser.add_argument("--load_weights_folder",
type=str,
help="name of model to load")
self.parser.add_argument("--models_to_load",
nargs="+",
type=str,
help="models to load",
default=["encoder", "depth"])
# LOGGING options
self.parser.add_argument("--log_frequency",
type=int,
help="number of steps between each log",
default=25)
self.parser.add_argument("--save_frequency",
type=int,
help="save frequency for visualization",
default=100)
self.parser.add_argument("--eval_frequency",
type=int,
help="number of steps between each save",
default=1000)
# RENDERING options
self.parser.add_argument("--render_type",
type=str,
help="rednering by the density or probability [density, prob, neus, volsdf]",
default='prob')
self.parser.add_argument("--stepsize",
type=float,
help="stepsize (in voxel) for rendering",
default=0.5)
# HYPERPARAMETERS
self.parser.add_argument("--semantic_loss_weight",
type=float, default=0.05,
help="the weight for the semantic loss")
self.parser.add_argument("--disparity_smoothness",
type=float,
help="disparity smoothness weight",
default=0.001)
self.parser.add_argument("--height_ori",
type=int,
help="original input image height",
default=1216)
self.parser.add_argument("--width_ori",
type=int,
help="original input image width",
default=1936)
self.parser.add_argument("--height",
type=int, default=336,
help="input image height")
self.parser.add_argument("--width",
type=int, default=672,
help="input image width")
self.parser.add_argument("--render_h",
type=int, default=224,
help="input image height")
self.parser.add_argument("--render_w",
type=int, default=352,
help="input image width")
self.parser.add_argument("--weight_entropy_last",
type=float, default=0.0)
self.parser.add_argument("--weight_distortion",
type=float, default=0.0)
self.parser.add_argument("--weight_sparse_reg",
type=float, default=0.0)
self.parser.add_argument("--min_depth",
type=float,
help="minimum depth",
default=0.1)
self.parser.add_argument("--max_depth",
type=float,
help="maximum depth",
default=80.0)
self.parser.add_argument("--min_depth_test",
type=float,
help="the min depth for the evaluation",
default=0.1)
self.parser.add_argument("--max_depth_test",
type=float,
help="the max depth for the evaluation",
default=80.0)
self.parser.add_argument("--en_lr",
type=float,
help="learning rate for encoder in volume rendering",
default=0.0001)
self.parser.add_argument("--de_lr",
type=float,
help="learning rate for decoder (3D CNN) in volume rendering",
default=0.001)
self.parser.add_argument("--aggregation",
type=str,
help="the type of the feature aggregation [mlp 3dcnn 2dcnn]",
default= '3dcnn')
self.parser.add_argument("--position", type=str,
help="rednering by the density or probability [No, embedding, embedding1]",
default='embedding')
self.parser.add_argument("--data_type", type=str,
help=" data size for traing and testing - > [train_all, all, mini, tiny]",
default='all')
self.parser.add_argument("--input_channel", type=int, help="the final feature channel in the encoder",
default=64)
self.parser.add_argument("--con_channel", type=int, help="the final feature channel in the encoder",
default=16)
self.parser.add_argument("--out_channel", type=int, help="the output channel of the voxel",
default=1)
self.parser.add_argument("--encoder", type=str,
help="the method for the comparison [101, 50]", default='101')
def parse(self):
self.options = self.parser.parse_args()
return self.options