-
Notifications
You must be signed in to change notification settings - Fork 1
/
cmd_parser.py
161 lines (153 loc) · 6.61 KB
/
cmd_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
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import print_function
from __future__ import division
import sys
import os
import configargparse
def parse_config(argv=None):
arg_formatter = configargparse.ArgumentDefaultsHelpFormatter
cfg_parser = configargparse.YAMLConfigFileParser
description = 'SEU-VCL Multi-Person project'
parser = configargparse.ArgParser(formatter_class=arg_formatter,
config_file_parser_class=cfg_parser,
description=description,
prog='Multi-Person')
# dataset
parser.add_argument('--trainset',
default='',
type=str,
help='trainset.')
parser.add_argument('--testset',
default='',
type=str,
help='testset.')
parser.add_argument('--data_folder',
default='',
help='The directory that contains the data.')
parser.add_argument('--output',
default='output',
type=str,
help='output.')
parser.add_argument('--use_mask',
default=False,
type=lambda x: x.lower() in ['true', '1'],
help='True for use mask.')
parser.add_argument('-c', '--config',
required=True, is_config_file=True,
help='config file path')
parser.add_argument('--note',
default='test',
type=str,
help='code note')
parser.add_argument('--lr',
default=0.0001,
type=float,
help='learning rate.')
parser.add_argument('--batchsize',
default=10,
type=int,
help='batch size.')
parser.add_argument('--epoch',
default=1,
type=int,
help='num epoch.')
parser.add_argument('--worker',
default=0,
type=int,
help='workers for dataloader.')
parser.add_argument('--mode',
default='train',
type=str,
help='train or test or eval')
parser.add_argument('--rgb_mode',
default=False,
type=lambda x: x.lower() in ['true', '1'],
help='True for add rgb encoder.')
parser.add_argument('--virtual_mask',
default=False,
type=lambda x: x.lower() in ['true', '1'],
help='True for using virtual mask.')
parser.add_argument('--uv_mask',
default=False,
type=lambda x: x.lower() in ['true', '1'],
help='True for use uv mask.')
parser.add_argument('--pretrain',
default=False,
type=lambda x: x.lower() in ['true', '1'],
help='True for use pretrain parameters.')
parser.add_argument('--pretrain_dir',
default='',
type=str,
help='The directory that contains the pretrain model.')
parser.add_argument('--model_dir',
default='',
type=str,
help='(if test only) The directory that contains the model.')
parser.add_argument('--model',
default='',
type=str,
help='the model used for this project.')
parser.add_argument('--poseseg',
default=False,
type=lambda x: x.lower() in ['true', '1'],
help='True for use poseseg.')
parser.add_argument('--pretrain_poseseg',
default=False,
type=lambda x: x.lower() in ['true', '1'],
help='True for use pretrain_poseseg.')
parser.add_argument('--use_disc',
default=False,
type=lambda x: x.lower() in ['true', '1'],
help='True for use discriminator.')
parser.add_argument('--train_loss',
default='L1',
type=str,
help='training loss type.')
parser.add_argument('--test_loss',
default='L1',
type=str,
help='testing loss type.')
parser.add_argument('--viz',
default=False,
type=lambda x: x.lower() in ['true', '1'],
help='True for visualize input.')
parser.add_argument('--task',
default='ed_train',
type=str,
help='ee_train: encoder-encoder only, else ed_train.')
parser.add_argument('--fixmodel_dir',
default='',
type=str,
help='fixed model dir for ee_train.')
parser.add_argument('--gpu_index',
default=0,
type=int,
help='gpu index.')
parser.add_argument('--fixmodel_type',
default='',
type=str,
help='fixmodel_type.')
parser.add_argument('--use_gt',
default=False,
type=lambda x: x.lower() in ['true', '1'],
help='use ground-truth 2D pose.')
parser.add_argument('--eval',
default=False,
type=lambda x: x.lower() in ['true', '1'],
help='eval mode.')
parser.add_argument('--data_folder2D',
default='',
type=str,
help='data_folder2D.')
parser.add_argument('--mesh_disc',
default=False,
type=lambda x: x.lower() in ['true', '1'],
help='use mesh disc.')
parser.add_argument('--pretrain_disc_dir',
default='',
type=str,
help='pretrain_disc_dir.')
args = parser.parse_args()
args_dict = vars(args)
return args_dict