-
Notifications
You must be signed in to change notification settings - Fork 0
/
parser.py
264 lines (255 loc) · 8.02 KB
/
parser.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
import configargparse
def config_parser():
parser = configargparse.ArgumentParser()
parser.add_argument("--config", is_config_file=True, help="config file path")
parser.add_argument("--expname", type=str, help="experiment name")
parser.add_argument(
"--basedir", type=str, default="./logs/", help="where to store ckpts and logs"
)
parser.add_argument(
"--datadir", type=str, default="./data/llff/fern", help="input data directory"
)
# training options
parser.add_argument("--netdepth", type=int, default=8, help="layers in network")
parser.add_argument("--netwidth", type=int, default=256, help="channels per layer")
parser.add_argument(
"--netdepth_fine", type=int, default=8, help="layers in fine network"
)
parser.add_argument(
"--netwidth_fine",
type=int,
default=256,
help="channels per layer in fine network",
)
parser.add_argument(
"--N_rand",
type=int,
default=32 * 32 * 4,
help="batch size (number of random rays per gradient step)",
)
parser.add_argument("--lrate", type=float, default=5e-4, help="learning rate")
parser.add_argument(
"--lrate_decay",
type=int,
default=300000,
help="exponential learning rate decay",
)
parser.add_argument(
"--chunk",
type=int,
default=1024 * 128,
help="number of rays processed in parallel, decrease if running out of memory",
)
parser.add_argument(
"--netchunk",
type=int,
default=1024 * 128,
help="number of pts sent through network in parallel, decrease if running out of memory",
)
parser.add_argument(
"--no_reload", action="store_true", help="do not reload weights from saved ckpt"
)
parser.add_argument(
"--ft_path",
type=str,
default=None,
help="specific weights npy file to reload for coarse network",
)
parser.add_argument(
"--random_seed", type=int, default=1, help="fix random seed for repeatability"
)
# rendering options
parser.add_argument(
"--N_samples", type=int, default=64, help="number of coarse samples per ray"
)
parser.add_argument(
"--N_importance",
type=int,
default=0,
help="number of additional fine samples per ray",
)
parser.add_argument(
"--perturb",
type=float,
default=1.0,
help="set to 0. for no jitter, 1. for jitter",
)
parser.add_argument(
"--use_viewdirs", action="store_true", help="use full 5D input instead of 3D"
)
parser.add_argument(
"--use_viewdirsDyn",
action="store_true",
help="use full 5D input instead of 3D for D-NeRF",
)
parser.add_argument(
"--i_embed",
type=int,
default=0,
help="set 0 for default positional encoding, -1 for none",
)
parser.add_argument(
"--multires",
type=int,
default=10,
help="log2 of max freq for positional encoding (3D location)",
)
parser.add_argument(
"--multires_views",
type=int,
default=4,
help="log2 of max freq for positional encoding (2D direction)",
)
parser.add_argument(
"--raw_noise_std",
type=float,
default=0.0,
help="std dev of noise added to regularize sigma_a output, 1e0 recommended",
)
parser.add_argument(
"--render_only",
action="store_true",
help="do not optimize, reload weights and render out render_poses path",
)
# dataset options
parser.add_argument(
"--dataset_type", type=str, default="llff", help="options: llff"
)
# llff flags
parser.add_argument(
"--factor", type=int, default=8, help="downsample factor for LLFF images"
)
parser.add_argument(
"--no_ndc",
action="store_true",
help="do not use normalized device coordinates (set for non-forward facing scenes)",
)
parser.add_argument(
"--lindisp",
action="store_true",
help="sampling linearly in disparity rather than depth",
)
parser.add_argument(
"--spherify", action="store_true", help="set for spherical 360 scenes"
)
# logging/saving options
parser.add_argument(
"--i_print",
type=int,
default=500,
help="frequency of console printout and metric logging",
)
parser.add_argument(
"--i_img", type=int, default=500, help="frequency of tensorboard image logging"
)
parser.add_argument(
"--i_weights", type=int, default=50000, help="frequency of weight ckpt saving"
)
parser.add_argument(
"--i_testset", type=int, default=50000, help="frequency of testset saving"
)
parser.add_argument(
"--i_video",
type=int,
default=50000,
help="frequency of render_poses video saving",
)
parser.add_argument(
"--N_iters", type=int, default=1000000, help="number of training iterations"
)
parser.add_argument(
"--pretrain_N_iters",
type=int,
default=1000000,
help="number of pretraining iterations",
)
parser.add_argument(
"--view_idx",
type=int,
default=0,
help="which view to keep constant during rendering of novel time",
)
parser.add_argument(
"--time_idx",
type=int,
default=0,
help="which time to keep constant during rendering of novel view",
)
# Dynamic NeRF lambdas
parser.add_argument(
"--dynamic_loss_lambda", type=float, default=1.0, help="lambda of dynamic loss"
)
parser.add_argument(
"--static_loss_lambda", type=float, default=1.0, help="lambda of static loss"
)
parser.add_argument(
"--full_loss_lambda", type=float, default=3.0, help="lambda of full loss"
)
parser.add_argument(
"--depth_loss_lambda", type=float, default=0.04, help="lambda of depth loss"
)
parser.add_argument(
"--order_loss_lambda", type=float, default=0.1, help="lambda of order loss"
)
parser.add_argument(
"--flow_loss_lambda",
type=float,
default=0.02,
help="lambda of optical flow loss",
)
parser.add_argument(
"--slow_loss_lambda",
type=float,
default=0.1,
help="lambda of sf slow regularization",
)
parser.add_argument(
"--smooth_loss_lambda",
type=float,
default=0.1,
help="lambda of sf smooth regularization",
)
parser.add_argument(
"--consistency_loss_lambda",
type=float,
default=0.1,
help="lambda of sf cycle consistency regularization",
)
parser.add_argument(
"--mask_loss_lambda", type=float, default=0.1, help="lambda of the mask loss"
)
parser.add_argument(
"--sparse_loss_lambda", type=float, default=0.1, help="lambda of sparse loss"
)
parser.add_argument(
"--pretrain", action="store_true", help="Pretrain the StaticneRF"
)
parser.add_argument(
"--fix_static_nerf_after_pretraining",
action="store_true",
help="Fix StaticNeRF after pretraining",
)
parser.add_argument(
"--ft_path_S",
type=str,
default=None,
help="specific weights npy file to reload for StaticNeRF",
)
# For rendering teasers
parser.add_argument(
"--frame2dolly", type=int, default=-1, help="choose frame to perform dolly zoom"
)
parser.add_argument(
"--x_trans_multiplier", type=float, default=1.0, help="x_trans_multiplier"
)
parser.add_argument(
"--y_trans_multiplier", type=float, default=0.33, help="y_trans_multiplier"
)
parser.add_argument(
"--z_trans_multiplier", type=float, default=5.0, help="z_trans_multiplier"
)
parser.add_argument("--num_novelviews", type=int, default=60, help="num_novelviews")
parser.add_argument(
"--focal_decrease", type=float, default=200, help="focal_decrease"
)
return parser