forked from aoliao12138/ReRF
-
Notifications
You must be signed in to change notification settings - Fork 0
/
default.py
131 lines (121 loc) · 5.87 KB
/
default.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
from copy import deepcopy
expname = None # experiment name
basedir = './logs/' # where to store ckpts and logs
train_mode = 'sequential'
fix_rgbnet = True
frame_num=200 # the number of frames you want to train
use_res=False
use_deform=""
deform_res_mode="separate"
deform_from_start=True
voxel_size=8
deform_low_reso=False
density_deform=False
res_lambda=0. # the weight of the L1 residual loss
deform_lambda=0. # the weight of the L1 deformation loss
pca_train = dict(
use_pca = False,
keyframes = [],
voxel_size = 10,
ratio = 0.1,
threshold = 1,
)
codec = dict(
rgbfeat_sigmoid=False,
)
''' Template of data options
'''
data = dict(
datadir=None, # path to dataset root folder
dataset_type=None, # blender | nsvf | blendedmvs | tankstemple | deepvoxels | co3d
inverse_y=False, # intrinsict mode (to support blendedmvs, nsvf, tankstemple)
flip_x=False, # to support co3d
flip_y=False, # to support co3d
annot_path='', # to support co3d
split_path='', # to support co3d
sequence_name='', # to support co3d
load2gpu_on_the_fly=False, # do not load all images into gpu (to save gpu memory)
testskip=1, # subsample testset to preview results
white_bkgd=False, # use white background (note that some dataset don't provide alpha and with blended bg color)
half_res=False, # [TODO]
# Below are forward-facing llff specific settings. Not support yet.
ndc=False, # use ndc coordinate (only for forward-facing; not support yet)
spherify=False, # inward-facing
factor=4, # [TODO]
width=None, # enforce image width
height=None, # enforce image height
llffhold=8, # testsplit
load_depths=False, # load depth
)
''' Template of training options
'''
coarse_train = dict(
N_iters=5000,
N_iters_pretrained=3000, # number of optimization steps
N_rand=10192, # batch size (number of random rays per optimization step)
lrate_density=1e-1, # lr of density voxel grid
lrate_k0=1.1e-1, # lr of color/feature voxel grid
lrate_rgbnet=2e-3, # lr of the mlp to preduct view-dependent color
lrate_decay=20, # lr decay by 0.1 after every lrate_decay*1000 steps
pervoxel_lr=True, # view-count-based lr
pervoxel_lr_downrate=1, # downsampled image for computing view-count-based lr
ray_sampler='random', # ray sampling strategies
weight_main=1.0, # weight of photometric loss
weight_entropy_last=0.01, # weight of background entropy loss
weight_rgbper=0.1, # weight of per-point rgb loss
tv_every=2, # count total variation loss every tv_every step
tv_after=0, # count total variation loss from tv_from step
tv_before=0, # count total variation before the given number of iterations
tv_dense_before=0, # count total variation densely before the given number of iterations
weight_tv_density=0.0000, # weight of total variation loss of density voxel grid
weight_tv_k0=0.0, # weight of total variation loss of color/feature voxel grid
pg_scale=[], # checkpoints for progressive scaling
pg_scale_pretrained = [],
skip_zero_grad_fields=[], # the variable name to skip optimizing parameters w/ zero grad in each iteration
)
fine_train = deepcopy(coarse_train)
fine_train.update(dict(
N_iters=16000,
N_iters_pretrained=16000,
weight_tv_deform=0.0000,
pervoxel_lr=False,
ray_sampler='in_maskcache',
weight_entropy_last=0.001,
weight_rgbper=0.01,
pg_scale=[ 1000, 3000, 5000],
pg_scale_pretrained=[ 1000, 2000, 4000],
skip_zero_grad_fields=['density', 'k0'],
))
''' Template of model and rendering options
'''
coarse_model_and_render = dict(
num_voxels=1024000, # expected number of voxel
num_voxels_base=1024000, # to rescale delta distance
mpi_depth=128, # the number of planes in Multiplane Image (work when ndc=True)
nearest=False, # nearest interpolation
pre_act_density=False, # pre-activated trilinear interpolation
in_act_density=False, # in-activated trilinear interpolation
bbox_thres=1e-3, # threshold to determine known free-space in the fine stage
mask_cache_thres=1e-3, # threshold to determine a tighten BBox in the fine stage
rgbnet_dim=0, # feature voxel grid dim
rgbnet_full_implicit=False, # let the colors MLP ignore feature voxel grid
rgbnet_direct=True, # set to False to treat the first 3 dim of feature voxel grid as diffuse rgb
rgbnet_depth=3, # depth of the colors MLP (there are rgbnet_depth-1 intermediate features)
rgbnet_width=129, # width of the colors MLP
alpha_init=1e-6, # set the alpha values everywhere at the begin of training
fast_color_thres=1e-7, # threshold of alpha value to skip the fine stage sampled point
maskout_near_cam_vox=True, # maskout grid points that between cameras and their near planes
world_bound_scale=1, # rescale the BBox enclosing the scene
stepsize=0.5, # sampling stepsize in volume rendering
)
fine_model_and_render = deepcopy(coarse_model_and_render)
fine_model_and_render.update(dict(
num_voxels=160**3,
num_voxels_base=160**3,
rgbnet_dim=9,
alpha_init=1e-2,
fast_color_thres=1e-4,
maskout_near_cam_vox=False,
world_bound_scale=1,
))
del deepcopy