-
Notifications
You must be signed in to change notification settings - Fork 20
/
options.py
166 lines (152 loc) · 7.7 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
# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
from __future__ import absolute_import, division, print_function
import os
import argparse
file_dir = os.path.dirname(__file__)
class DistDepthOptions:
def __init__(self):
self.parser = argparse.ArgumentParser(description="DistDepth options")
# EXECUTION mode
self.parser.add_argument("--exe",
type=str,
help="execution option",
default="eval_save",
choices=["train", "eval_save", "eval_save_all", "eval_measure", "eval_measure-M"])
# PATHS
self.parser.add_argument("--data_path",
type=str,
help="path to the training data",
default=os.path.join(file_dir, "Habitat_sim"))
self.parser.add_argument("--log_dir",
type=str,
help="log directory",
default=os.path.join(os.path.expanduser("~"), "tmp"))
# TRAINING options
self.parser.add_argument("--model_name",
type=str,
help="the name of the folder to save the model in",
default="distdepth")
self.parser.add_argument("--num_layers",
type=int,
help="number of ResNet layers",
default=152,
choices=[18, 34, 50, 101, 152])
self.parser.add_argument("--dataset",
type=str,
help="dataset option",
default="SimSIN",
choices=["VA", "SimSIN", "UniSIN", "NYUv2"])
self.parser.add_argument("--height",
type=int,
help="input image height",
default=256)
self.parser.add_argument("--width",
type=int,
help="input image width",
default=256)
self.parser.add_argument("--scales",
nargs="+",
type=int,
help="scales used in the loss",
default=[0, 1, 2, 3])
self.parser.add_argument("--thre",
type=float,
help="threshold for edge map",
default=0.95)
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=12.0)
self.parser.add_argument("--use_stereo",
help="if set, uses stereo pair for training",
action="store_true")
self.parser.add_argument("--disparity_smoothness",
type=float,
help="disparity smoothness weight",
default=1e-3)
self.parser.add_argument("--dist_wt",
type=float,
help="distillation loss weight",
default=0.05)
self.parser.add_argument("--frame_ids",
nargs="+",
type=int,
help="frames to load",
default=[0, -1, 1])
self.parser.add_argument("--weights_init",
type=str,
help="pretrained or scratch",
default="pretrained",
choices=["pretrained", "scratch"])
# OPTIMIZATION options
self.parser.add_argument("--batch_size",
type=int,
help="batch size",
default=50)
self.parser.add_argument("--learning_rate",
type=float,
help="learning rate",
default=1e-1)
self.parser.add_argument("--num_epochs",
type=int,
help="number of epochs",
default=10)
self.parser.add_argument("--scheduler_step_size",
type=int,
help="step size of the scheduler",
default=10)
# SYSTEM options
self.parser.add_argument("--no_cuda",
help="if set disables CUDA",
action="store_true")
self.parser.add_argument("--num_workers",
type=int,
help="number of dataloader workers",
default=10)
# 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", "pose_encoder", "pose", "img"])
# LOGGING options
self.parser.add_argument("--log_frequency",
type=int,
help="number of batches between each tensorboard log",
default=250)
self.parser.add_argument("--save_frequency",
type=int,
help="number of epochs between each save",
default=1)
# Multi options
self.parser.add_argument('--use_future_frame',
action='store_true',
help='If set, will also use a future frame in time for matching.')
self.parser.add_argument('--num_matching_frames',
help='Sets how many previous frames to load to build the cost'
'volume',
type=int,
default=1)
self.parser.add_argument("--depth_binning",
help="defines how the depth bins are constructed for the cost"
"volume. 'linear' is uniformly sampled in depth space,"
"'inverse' is uniformly sampled in inverse depth space",
type=str,
choices=['linear', 'inverse'],
default='linear'),
self.parser.add_argument("--num_depth_bins",
type=int,
default=96)
def parse(self):
self.options = self.parser.parse_args()
return self.options