-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhrnet_video_0.py
182 lines (175 loc) · 6.91 KB
/
hrnet_video_0.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
log_level = 'INFO'
load_from = 'https://download.openmmlab.com/mmpose/top_down/hrnet/hrnet_w48_coco_wholebody_384x288-6e061c6a_20200922.pth'
resume_from = None
dist_params = dict(backend='nccl')
workflow = [('train', 1),('train', 1),('train', 1),('train', 1),('train', 1),('train', 1),('train', 1),('train', 1),('train', 1),('train', 1),('train', 1), ('val', 1),
('train', 1),('train', 1),('train', 1),('train', 1),('train', 1),('train', 1),('train', 1),('train', 1),('train', 1),('train', 1),('train', 1), ('val', 1),
('train', 1),('train', 1),('train', 1),('train', 1),('train', 1),('train', 1),('train', 1),('train', 1),('train', 1),('train', 1),('train', 1), ('val', 1),
('train', 1),('train', 1),('train', 1),('train', 1),('train', 1),('train', 1),('train', 1),('train', 1),('train', 1),('train', 1),('train', 1), ('val', 1),
('train', 1),('train', 1),('train', 1),('train', 1),('train', 1),('train', 1),('train', 1),('train', 1),('train', 1),('train', 1),('train', 1), ('val', 1),
('train', 1),('train', 1),('train', 1),('train', 1),('train', 1),('train', 1),('train', 1),('train', 1),('train', 1),('train', 1),('train', 1), ('val', 1),
('train', 1),('train', 1),('train', 1),('train', 1),('train', 1),('train', 1),('train', 1),('train', 1),('train', 1),('train', 1),('train', 1), ('val', 1),
('train', 1),('train', 1),('train', 1),('train', 1),('train', 1),('train', 1),('train', 1),('train', 1),('train', 1),('train', 1),('train', 1), ('val', 1),
('train', 1),('train', 1),('train', 1),('train', 1),('train', 1),('train', 1),('train', 1),('train', 1),('train', 1),('train', 1),('train', 1), ('val', 1),
('train', 1),('train', 1),('train', 1),('train', 1),('train', 1),('train', 1),('train', 1),('train', 1),('train', 1),('train', 1),('train', 1), ('val', 1),
('train', 1),('train', 1),('train', 1),('train', 1),('train', 1),('train', 1),('train', 1),('train', 1),('train', 1),('train', 1),('train', 1), ('val', 1),
('train', 1),('train', 1),('train', 1),('train', 1),('train', 1),('train', 1),('train', 1),('train', 1),('train', 1),('train', 1),('train', 1), ('val', 1)]
checkpoint_config = dict(interval=6)#After how many epochs to save
evaluation = dict(interval=12, metric='mAP', key_indicator='AP')#after how many epochs to evaluate
optimizer = dict(
type='Adam',
lr=1e-4,
)
optimizer_config = dict(grad_clip=None)
# learning policy
lr_config = dict(
policy='step',
#warmup=None,
warmup='linear',
warmup_iters=500,
warmup_ratio=0.001,
step=[10, 15])
total_epochs = 148
log_config = dict(
interval=50,
hooks=[
dict(type='TextLoggerHook'),
# dict(type='TensorboardLoggerHook')
])
channel_cfg = dict(
num_output_channels=133,
dataset_joints=133,
dataset_channel=[
list(range(133)),
],
inference_channel=list(range(133)))
# model settings
model = dict(
type='TopDown',
pretrained='https://download.openmmlab.com/mmpose/'
'pretrain_models/hrnet_w48-8ef0771d.pth',
backbone=dict(
type='HRNet',
in_channels=3,
extra=dict(
stage1=dict(
num_modules=1,
num_branches=1,
block='BOTTLENECK',
num_blocks=(4, ),
num_channels=(64, )),
stage2=dict(
num_modules=1,
num_branches=2,
block='BASIC',
num_blocks=(4, 4),
num_channels=(48, 96)),
stage3=dict(
num_modules=4,
num_branches=3,
block='BASIC',
num_blocks=(4, 4, 4),
num_channels=(48, 96, 192)),
stage4=dict(
num_modules=3,
num_branches=4,
block='BASIC',
num_blocks=(4, 4, 4, 4),
num_channels=(48, 96, 192, 384))),
),
keypoint_head=dict(
type='TopDownSimpleHead',
in_channels=48,
out_channels=channel_cfg['num_output_channels'],
num_deconv_layers=0,
extra=dict(final_conv_kernel=1, ),
loss_keypoint=dict(type='JointsMSELoss', use_target_weight=True)),
train_cfg=dict(),
test_cfg=dict(
flip_test=True,
post_process='default',
shift_heatmap=True,
modulate_kernel=11))
data_cfg = dict(
image_size=[288, 384],
heatmap_size=[72, 96],
num_output_channels=channel_cfg['num_output_channels'],
num_joints=channel_cfg['dataset_joints'],
dataset_channel=channel_cfg['dataset_channel'],
inference_channel=channel_cfg['inference_channel'],
soft_nms=False,
nms_thr=1.0,
oks_thr=0.9,
vis_thr=0.2,
use_gt_bbox=True,
det_bbox_thr=0.0,
bbox_file='/vol/research/SignRecognition/swisstxt/weather/2020-03-01.json',
)
train_pipeline = [
dict(type='LoadImageFromlmdb'),
dict(type='TopDownRandomFlip', flip_prob=0.5),
dict(
type='TopDownHalfBodyTransform',
num_joints_half_body=8,
prob_half_body=0.3),
dict(
type='TopDownGetRandomScaleRotation', rot_factor=40, scale_factor=0.5),
dict(type='TopDownAffine'),
dict(type='ToTensor'),
dict(
type='NormalizeTensor',
mean=[0.485, 0.456, 0.406],
std=[0.229, 0.224, 0.225]),
dict(type='TopDownGenerateTarget', sigma=3),
dict(
type='Collect',
keys=['img', 'target', 'target_weight'],
meta_keys=[
'image_file', 'joints_3d', 'joints_3d_visible', 'center', 'scale',
'rotation', 'bbox_score', 'flip_pairs'
]),
]
val_pipeline = [
dict(type='LoadImageFromlmdb'),
dict(type='TopDownAffine'),
dict(type='ToTensor'),
dict(
type='NormalizeTensor',
mean=[0.485, 0.456, 0.406],
std=[0.229, 0.224, 0.225]),
dict(
type='Collect',
keys=['img'],
meta_keys=[
'image_file', 'center', 'scale', 'rotation', 'bbox_score',
'flip_pairs'
]),
]
test_pipeline = val_pipeline
json_root = "/vol/research/SignTranslation/data/SWISSTXT/mmpose/single_video"
video_root = '/vol/research/SignTranslation/data/SWISSTXT/mmpose/single_video'
data = dict(
samples_per_gpu=4,
workers_per_gpu=2,
train_dataloader=dict(
shuffle=False
),
train=dict(
type='TopDownCocoWholeBodyLazyDataset',
ann_file=[],
img_prefix=f'{video_root}/',
data_cfg=data_cfg,
pipeline=train_pipeline),
val=dict(
type='TopDownCocoWholeBodyLazyDataset',
ann_file=[f'{json_root}/shard_93.json', f'{json_root}/shard_94.json', f'{json_root}/shard_95.json', f'{json_root}/shard_96.json', f'{json_root}/shard_97.json', f'{json_root}/shard_98.json', f'{json_root}/shard_99.json'],
img_prefix=f'{video_root}/',
data_cfg=data_cfg,
pipeline=val_pipeline),
test=dict(
type='TopDownCocoWholeBodyLazyDataset',
ann_file=f'{json_root}/shard_0.json',#shard_93
img_prefix=f'{video_root}/',
data_cfg=data_cfg,
pipeline=test_pipeline),
)