-
Notifications
You must be signed in to change notification settings - Fork 31
/
opt.py
75 lines (67 loc) · 3.99 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
import argparse
def get_opts():
parser = argparse.ArgumentParser()
parser.add_argument('--root_dir', type=str,
default='/home/ubuntu/data/mvs_training/dtu/',
help='root directory of dtu dataset')
parser.add_argument('--dataset_name', type=str, default='dtu',
choices=['dtu', 'blendedmvs'],
help='which dataset to train/val')
parser.add_argument('--n_views', type=int, default=3,
help='number of views (including ref) to be used in training')
parser.add_argument('--levels', type=int, default=3, choices=[3],
help='number of FPN levels (fixed to be 3!)')
parser.add_argument('--depth_interval', type=float, default=2.65,
help='depth interval for the finest level, unit in mm')
parser.add_argument('--n_depths', nargs='+', type=int, default=[8,32,48],
help='number of depths in each level')
parser.add_argument('--interval_ratios', nargs='+', type=float, default=[1.0,2.0,4.0],
help='depth interval ratio to multiply with --depth_interval in each level')
parser.add_argument('--num_groups', type=int, default=1, choices=[1, 2, 4, 8],
help='number of groups in groupwise correlation, must be a divisor of 8')
parser.add_argument('--loss_type', type=str, default='sl1',
choices=['sl1'],
help='loss to use')
parser.add_argument('--batch_size', type=int, default=1,
help='batch size')
parser.add_argument('--num_epochs', type=int, default=16,
help='number of training epochs')
parser.add_argument('--num_gpus', type=int, default=1,
help='number of gpus')
parser.add_argument('--ckpt_path', type=str, default='',
help='pretrained checkpoint path to load')
parser.add_argument('--prefixes_to_ignore', nargs='+', type=str, default=['loss'],
help='the prefixes to ignore in the checkpoint state dict')
parser.add_argument('--optimizer', type=str, default='sgd',
help='optimizer type',
choices=['sgd', 'adam', 'radam', 'ranger'])
parser.add_argument('--lr', type=float, default=1e-3,
help='learning rate')
parser.add_argument('--momentum', type=float, default=0.9,
help='learning rate momentum')
parser.add_argument('--weight_decay', type=float, default=1e-5,
help='weight decay')
parser.add_argument('--lr_scheduler', type=str, default='steplr',
help='scheduler type',
choices=['steplr', 'cosine', 'poly'])
#### params for warmup, only applied when optimizer == 'sgd' or 'adam'
parser.add_argument('--warmup_multiplier', type=float, default=1.0,
help='lr is multiplied by this factor after --warmup_epochs')
parser.add_argument('--warmup_epochs', type=int, default=0,
help='Gradually warm-up(increasing) learning rate in optimizer')
###########################
#### params for steplr ####
parser.add_argument('--decay_step', nargs='+', type=int, default=[20],
help='scheduler decay step')
parser.add_argument('--decay_gamma', type=float, default=0.1,
help='learning rate decay amount')
###########################
#### params for poly ####
parser.add_argument('--poly_exp', type=float, default=0.9,
help='exponent for polynomial learning rate decay')
###########################
parser.add_argument('--use_amp', default=False, action="store_true",
help='use mixed precision training (NOT SUPPORTED!)')
parser.add_argument('--exp_name', type=str, default='exp',
help='experiment name')
return parser.parse_args()