-
Notifications
You must be signed in to change notification settings - Fork 1
/
opt.py
185 lines (165 loc) · 9.13 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
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
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
import argparse
import torch.utils.data as data
class Mscoco(data.Dataset):
def __init__(self, train=True, sigma=1,
scale_factor=(0.2, 0.3), rot_factor=40, label_type='Gaussian'):
self.img_folder = '../data/coco/images' # root image folders
self.is_train = train # training set or test set
self.inputResH = opt.inputResH
self.inputResW = opt.inputResW
self.outputResH = opt.outputResH
self.outputResW = opt.outputResW
self.sigma = sigma
self.scale_factor = scale_factor
self.rot_factor = rot_factor
self.label_type = label_type
self.nJoints_coco = 17
self.nJoints_mpii = 16
self.nJoints = 33
self.accIdxs = (1, 2, 3, 4, 5, 6, 7, 8,
9, 10, 11, 12, 13, 14, 15, 16, 17)
self.flipRef = ((2, 3), (4, 5), (6, 7),
(8, 9), (10, 11), (12, 13),
(14, 15), (16, 17))
def __getitem__(self, index):
pass
def __len__(self):
pass
parser = argparse.ArgumentParser(description='Train a OPEC-GCN Module')
"----------------------------- General options -----------------------------"
parser.add_argument('--expID', default='default', type=str,
help='Experiment ID')
parser.add_argument('--dataset', default='coco', type=str,
help='Dataset choice: mpii | coco')
parser.add_argument('--nThreads', default=30, type=int,
help='Number of data loading threads')
parser.add_argument('--debug', default=False, type=bool,
help='Print the debug information')
parser.add_argument('--snapshot', default=1, type=int,
help='How often to take a snapshot of the model (0 = never)')
"----------------------------- AlphaPose options -----------------------------"
parser.add_argument('--addDPG', default=False, type=bool,
help='Train with data augmentation')
parser.add_argument('--sp', default=False, action='store_true',
help='Use single process for pytorch')
parser.add_argument('--profile', default=False, action='store_true',
help='add speed profiling at screen output')
"----------------------------- Model options -----------------------------"
parser.add_argument('--netType', default='hgPRM', type=str,
help='Options: hgPRM | resnext')
parser.add_argument('--loadModel', default=None, type=str,
help='Provide full path to a previously trained model')
parser.add_argument('--Continue', default=False, type=bool,
help='Pick up where an experiment left off')
parser.add_argument('--nFeats', default=256, type=int,
help='Number of features in the hourglass')
parser.add_argument('--nClasses', default=33, type=int,
help='Number of output channel')
parser.add_argument('--nStack', default=4, type=int,
help='Number of hourglasses to stack')
"----------------------------- Hyperparameter options -----------------------------"
parser.add_argument('--fast_inference', default=True, type=bool,
help='Fast inference')
parser.add_argument('--use_pyranet', default=True, type=bool,
help='use pyranet')
"----------------------------- Hyperparameter options -----------------------------"
parser.add_argument('--LR', default=2.5e-4, type=float,
help='Learning rate')
parser.add_argument('--momentum', default=0, type=float,
help='Momentum')
parser.add_argument('--weightDecay', default=0, type=float,
help='Weight decay')
parser.add_argument('--crit', default='MSE', type=str,
help='Criterion type')
parser.add_argument('--optMethod', default='rmsprop', type=str,
help='Optimization method: rmsprop | sgd | nag | adadelta')
parser.add_argument('--save_dirs', default='checkpoint', type=str,
help='where to save our project')
parser.add_argument('--load_dirs', type=str,
help='where to load our project')
"----------------------------- Training options -----------------------------"
parser.add_argument('--nEpochs', default=50, type=int,
help='Number of hourglasses to stack')
parser.add_argument('--epoch', default=0, type=int,
help='Current epoch')
parser.add_argument('--trainBatch', default=20, type=int,
help='Train-batch size')
parser.add_argument('--validBatch', default=20, type=int,
help='Valid-batch size')
parser.add_argument('--trainIters', default=0, type=int,
help='Total train iters')
parser.add_argument('--valIters', default=0, type=int,
help='Total valid iters')
parser.add_argument('--init', default=None, type=str,
help='Initialization')
"----------------------------- Data options -----------------------------"
parser.add_argument('--inputResH', default=320, type=int,
help='Input image height')
parser.add_argument('--inputResW', default=256, type=int,
help='Input image width')
parser.add_argument('--outputResH', default=80, type=int,
help='Output heatmap height')
parser.add_argument('--outputResW', default=64, type=int,
help='Output heatmap width')
parser.add_argument('--scale', default=0.25, type=float,
help='Degree of scale augmentation')
parser.add_argument('--rotate', default=30, type=float,
help='Degree of rotation augmentation')
parser.add_argument('--hmGauss', default=1, type=int,
help='Heatmap gaussian size')
"----------------------------- PyraNet options -----------------------------"
parser.add_argument('--baseWidth', default=9, type=int,
help='Heatmap gaussian size')
parser.add_argument('--cardinality', default=5, type=int,
help='Heatmap gaussian size')
parser.add_argument('--nResidual', default=1, type=int,
help='Number of residual modules at each location in the pyranet')
"----------------------------- Distribution options -----------------------------"
parser.add_argument('--dist', dest='dist', type=int, default=1,
help='distributed training or not')
parser.add_argument('--backend', dest='backend', type=str, default='gloo',
help='backend for distributed training')
parser.add_argument('--port', dest='port',
help='port of server')
"----------------------------- Detection options -----------------------------"
parser.add_argument('--net', dest='demo_net', help='Network to use [vgg16 res101]',
default='res152')
parser.add_argument('--indir', dest='inputpath',
help='image-directory', default="")
parser.add_argument('--list', dest='inputlist',
help='image-list', default="")
parser.add_argument('--mode', dest='mode',
help='detection mode, fast/normal/accurate', default="normal")
parser.add_argument('--outdir', dest='outputpath',
help='output-directory', default="examples/res/")
parser.add_argument('--inp_dim', dest='inp_dim', type=str, default='608',
help='inpdim')
parser.add_argument('--conf', dest='confidence', type=float, default=0.05,
help='bounding box confidence threshold')
parser.add_argument('--nms', dest='nms_thesh', type=float, default=0.6,
help='bounding box nms threshold')
parser.add_argument('--save_img', default=False, action='store_true',
help='save result as image')
parser.add_argument('--vis', default=False, action='store_true',
help='visualize image')
parser.add_argument('--matching', default=False, action='store_true',
help='use best matching')
parser.add_argument('--format', type=str,
help='save in the format of cmu or coco or openpose, option: coco/cmu/open')
parser.add_argument('--detbatch', type=int, default=1,
help='detection batch size')
parser.add_argument('--posebatch', type=int, default=80,
help='pose estimation maximum batch size')
"----------------------------- Video options -----------------------------"
parser.add_argument('--video', dest='video',
help='video-name', default="")
parser.add_argument('--webcam', dest='webcam', type=str,
help='webcam number', default='0')
parser.add_argument('--save_video', dest='save_video',
help='whether to save rendered video', default=False, action='store_true')
parser.add_argument('--vis_fast', dest='vis_fast',
help='use fast rendering', action='store_true', default=False)
"----------------------------- OPEC-GCN configs -----------------------------"
parser.add_argument('--config', help='train config file path')
opt = parser.parse_args()
opt.num_classes = 80