-
Notifications
You must be signed in to change notification settings - Fork 2
/
opt.py
111 lines (98 loc) · 4.06 KB
/
opt.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
import argparse
def get_opts(prefix_args=None):
parser = argparse.ArgumentParser()
# dataset parameters
parser.add_argument('--root_dir',
type=str,
required=True,
help='root directory of dataset')
parser.add_argument('--dataset_name',
type=str,
default='nsvf',
choices=['nerf', 'nsvf', 'colmap', 'ngp', 'brics'],
help='which dataset to train/test')
parser.add_argument('--split',
type=str,
default='train',
choices=['train', 'trainval', 'trainvaltest'],
help='use which split to train')
parser.add_argument('--downsample',
type=float,
default=1.0,
help='downsample factor (<=1.0) for the images')
# model parameters
parser.add_argument(
'--scale',
type=float,
default=0.5,
help='scene scale (whole scene must lie in [-scale, scale]^3')
parser.add_argument('--half2_opt',
action='store_true',
default=False,
help='whether to use half2 optimization')
parser.add_argument('--encoder_type',
type=str,
default='hash',
choices=['hash', 'triplane'],
help='which encoder to use')
# loss parameters
parser.add_argument('--distortion_loss_w',
type=float,
default=0,
help='''weight of distortion loss (see losses.py),
0 to disable (default), to enable,
a good value is 1e-3 for real scene and 1e-2 for synthetic scene
''')
# training options
parser.add_argument('--batch_size',
type=int,
default=8192,
help='number of rays in a batch')
parser.add_argument('--ray_sampling_strategy',
type=str,
default='all_images',
choices=['all_images', 'same_image'],
help='''
all_images: uniformly from all pixels of ALL images
same_image: uniformly from all pixels of a SAME image
''')
parser.add_argument('--num_epochs',
type=int,
default=30,
help='number of training epochs')
parser.add_argument('--lr', type=float, default=1e-2, help='learning rate')
parser.add_argument(
'--random_bg',
action='store_true',
default=False,
help='''whether to train with random bg color (real scene only)
to avoid objects with black color to be predicted as transparent
''')
# validation options
parser.add_argument('--val_only',
action='store_true',
default=False,
help='run only validation (need to provide ckpt_path)')
parser.add_argument('--no_save_test',
action='store_true',
default=False,
help='whether to save test image and video')
# misc
parser.add_argument('--exp_name',
type=str,
default='exp',
help='experiment name')
parser.add_argument(
'--ckpt_path',
type=str,
default=None,
help='pretrained checkpoint to load (including optimizers, etc)')
parser.add_argument(
'--gui',
action='store_true',
default=False,
help='whether to show interactive GUI after training is done'
)
# performance profile
parser.add_argument('--perf', action='store_true', default=False)
return parser.parse_args(prefix_args)