-
-
Notifications
You must be signed in to change notification settings - Fork 156
/
opt.py
70 lines (62 loc) · 3.57 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
import argparse
def get_opts():
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', 'nerfpp', 'rtmv'],
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('--use_exposure', action='store_true', default=False,
help='whether to train in HDR-NeRF setting')
# 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('--num_gpus', type=int, default=1,
help='number of gpus')
parser.add_argument('--lr', type=float, default=1e-2,
help='learning rate')
# experimental training options
parser.add_argument('--optimize_ext', action='store_true', default=False,
help='whether to optimize extrinsics')
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('--eval_lpips', action='store_true', default=False,
help='evaluate lpips metric (consumes more VRAM)')
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('--weight_path', type=str, default=None,
help='pretrained checkpoint to load (excluding optimizers, etc)')
return parser.parse_args()