Skip to content

Commit 0d2568d

Browse files
authored
Support COCO-Wholebody (open-mmlab#133)
1 parent 4229e92 commit 0d2568d

20 files changed

+9646
-14
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ venv.bak/
106106

107107
# custom
108108
mmpose/version.py
109+
/models
109110
/data
110111
.vscode
111112
.idea

configs/top_down/darkpose/README.md

+8
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,11 @@
2424
| [dark_pose_hrnet_w32](/configs/top_down/darkpose/coco/hrnet_w32_coco_384x288_dark.py) | 384x288 | 0.767 | 0.909 | 0.832 | 0.816 | 0.944 | [ckpt](https://openmmlab.oss-accelerate.aliyuncs.com/mmpose/top_down/hrnet/hrnet_w32_coco_384x288_dark-459422a4_20200812.pth) | [log](https://openmmlab.oss-accelerate.aliyuncs.com/mmpose/top_down/hrnet/hrnet_w32_coco_384x288_dark_20200812.log.json) |
2525
| [dark_pose_hrnet_w48](/configs/top_down/darkpose/coco/hrnet_w48_coco_256x192_dark.py) | 256x192 | 0.764 | 0.907 | 0.830 | 0.814 | 0.943 | [ckpt](https://openmmlab.oss-accelerate.aliyuncs.com/mmpose/top_down/hrnet/hrnet_w48_coco_256x192_dark-8cba3197_20200812.pth) | [log](https://openmmlab.oss-accelerate.aliyuncs.com/mmpose/top_down/hrnet/hrnet_w48_coco_256x192_dark_20200812.log.json) |
2626
| [dark_pose_hrnet_w48](/configs/top_down/darkpose/coco/hrnet_w48_coco_384x288_dark.py) | 384x288 | 0.773 | 0.910 | 0.833 | 0.820 | 0.946 | [ckpt](https://openmmlab.oss-accelerate.aliyuncs.com/mmpose/top_down/hrnet/hrnet_w48_coco_384x288_dark-741844ba_20200812.pth) | [log](https://openmmlab.oss-accelerate.aliyuncs.com/mmpose/top_down/hrnet/hrnet_w48_coco_384x288_dark_20200812.log.json) |
27+
28+
### Results on COCO-WholeBody val2017 with detector having human AP of 56.4 on COCO val2017 dataset
29+
30+
| Arch | Input Size | Body AP | Body AR | Foot AP | Foot AR | Face AP | Face AR | Hand AP | Hand AR | Whole AP | Whole AR | ckpt | log |
31+
| :---- | :--------: | :-----: | :-----: | :-----: | :-----: | :-----: | :------: | :-----: | :-----: | :------: |:-------: |:------: | :------: |
32+
| [dark_pose_hrnet_w48+](/configs/top_down/darkpose/coco-wholebody/hrnet_w48_coco_wholebody_384x288_dark.py) | 384x288 | 0.742 | 0.807 | 0.705 | 0.804 | 0.840 | 0.892 | 0.602 | 0.694 | 0.661 | 0.743 | [ckpt](https://openmmlab.oss-accelerate.aliyuncs.com/mmpose/top_down/hrnet/hrnet_w32_coco_256x192-c78dce93_20200708.pth) | [log](https://openmmlab.oss-accelerate.aliyuncs.com/mmpose/top_down/hrnet/hrnet_w32_coco_256x192_20200708.log.json) |
33+
34+
Note: `+` means the model is first pre-trained on original COCO dataset, and then fine-tuned on COCO-WholeBody dataset. We find this will lead to better performance.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,172 @@
1+
log_level = 'INFO'
2+
load_from = None
3+
resume_from = None
4+
dist_params = dict(backend='nccl')
5+
workflow = [('train', 1)]
6+
checkpoint_config = dict(interval=10)
7+
evaluation = dict(interval=10, metric='mAP', key_indicator='AP')
8+
9+
optimizer = dict(
10+
type='Adam',
11+
lr=5e-4,
12+
)
13+
optimizer_config = dict(grad_clip=None)
14+
# learning policy
15+
lr_config = dict(
16+
policy='step',
17+
warmup='linear',
18+
warmup_iters=500,
19+
warmup_ratio=0.001,
20+
step=[170, 200])
21+
total_epochs = 210
22+
log_config = dict(
23+
interval=50,
24+
hooks=[
25+
dict(type='TextLoggerHook'),
26+
# dict(type='TensorboardLoggerHook')
27+
])
28+
29+
channel_cfg = dict(
30+
num_output_channels=133,
31+
dataset_joints=133,
32+
dataset_channel=[
33+
list(range(133)),
34+
],
35+
inference_channel=list(range(133)))
36+
37+
# model settings
38+
model = dict(
39+
type='TopDown',
40+
pretrained='models/pytorch/imagenet/hrnet_w32-36af842e.pth',
41+
backbone=dict(
42+
type='HRNet',
43+
in_channels=3,
44+
extra=dict(
45+
stage1=dict(
46+
num_modules=1,
47+
num_branches=1,
48+
block='BOTTLENECK',
49+
num_blocks=(4, ),
50+
num_channels=(64, )),
51+
stage2=dict(
52+
num_modules=1,
53+
num_branches=2,
54+
block='BASIC',
55+
num_blocks=(4, 4),
56+
num_channels=(32, 64)),
57+
stage3=dict(
58+
num_modules=4,
59+
num_branches=3,
60+
block='BASIC',
61+
num_blocks=(4, 4, 4),
62+
num_channels=(32, 64, 128)),
63+
stage4=dict(
64+
num_modules=3,
65+
num_branches=4,
66+
block='BASIC',
67+
num_blocks=(4, 4, 4, 4),
68+
num_channels=(32, 64, 128, 256))),
69+
),
70+
keypoint_head=dict(
71+
type='TopDownSimpleHead',
72+
in_channels=32,
73+
out_channels=channel_cfg['num_output_channels'],
74+
num_deconv_layers=0,
75+
extra=dict(final_conv_kernel=1, ),
76+
),
77+
train_cfg=dict(),
78+
test_cfg=dict(
79+
flip_test=True,
80+
post_process=True,
81+
shift_heatmap=True,
82+
unbiased_decoding=True,
83+
modulate_kernel=11),
84+
loss_pose=dict(type='JointsMSELoss', use_target_weight=True))
85+
86+
data_cfg = dict(
87+
image_size=[192, 256],
88+
heatmap_size=[48, 64],
89+
num_output_channels=channel_cfg['num_output_channels'],
90+
num_joints=channel_cfg['dataset_joints'],
91+
dataset_channel=channel_cfg['dataset_channel'],
92+
inference_channel=channel_cfg['inference_channel'],
93+
soft_nms=False,
94+
nms_thr=1.0,
95+
oks_thr=0.9,
96+
vis_thr=0.2,
97+
bbox_thr=1.0,
98+
use_gt_bbox=False,
99+
image_thr=0.0,
100+
bbox_file='data/coco/person_detection_results/'
101+
'COCO_val2017_detections_AP_H_56_person.json',
102+
)
103+
104+
train_pipeline = [
105+
dict(type='LoadImageFromFile'),
106+
dict(type='TopDownRandomFlip', flip_prob=0.5),
107+
dict(
108+
type='TopDownHalfBodyTransform',
109+
num_joints_half_body=8,
110+
prob_half_body=0.3),
111+
dict(
112+
type='TopDownGetRandomScaleRotation', rot_factor=40, scale_factor=0.5),
113+
dict(type='TopDownAffine'),
114+
dict(type='ToTensor'),
115+
dict(
116+
type='NormalizeTensor',
117+
mean=[0.485, 0.456, 0.406],
118+
std=[0.229, 0.224, 0.225]),
119+
dict(type='TopDownGenerateTarget', sigma=2, unbiased_encoding=True),
120+
dict(
121+
type='Collect',
122+
keys=['img', 'target', 'target_weight'],
123+
meta_keys=[
124+
'image_file', 'joints_3d', 'joints_3d_visible', 'center', 'scale',
125+
'rotation', 'bbox_score', 'flip_pairs'
126+
]),
127+
]
128+
129+
val_pipeline = [
130+
dict(type='LoadImageFromFile'),
131+
dict(type='TopDownAffine'),
132+
dict(type='ToTensor'),
133+
dict(
134+
type='NormalizeTensor',
135+
mean=[0.485, 0.456, 0.406],
136+
std=[0.229, 0.224, 0.225]),
137+
dict(
138+
type='Collect',
139+
keys=[
140+
'img',
141+
],
142+
meta_keys=[
143+
'image_file', 'center', 'scale', 'rotation', 'bbox_score',
144+
'flip_pairs'
145+
]),
146+
]
147+
148+
test_pipeline = val_pipeline
149+
150+
data_root = 'data/coco'
151+
data = dict(
152+
samples_per_gpu=64,
153+
workers_per_gpu=2,
154+
train=dict(
155+
type='TopDownCocoWholeBodyDataset',
156+
ann_file=f'{data_root}/annotations/coco_wholebody_train_v1.0.json',
157+
img_prefix=f'{data_root}/train2017/',
158+
data_cfg=data_cfg,
159+
pipeline=train_pipeline),
160+
val=dict(
161+
type='TopDownCocoWholeBodyDataset',
162+
ann_file=f'{data_root}/annotations/coco_wholebody_val_v1.0.json',
163+
img_prefix=f'{data_root}/val2017/',
164+
data_cfg=data_cfg,
165+
pipeline=val_pipeline),
166+
test=dict(
167+
type='TopDownCocoWholeBodyDataset',
168+
ann_file=f'{data_root}/annotations/coco_wholebody_val_v1.0.json',
169+
img_prefix=f'{data_root}/val2017/',
170+
data_cfg=data_cfg,
171+
pipeline=val_pipeline),
172+
)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,172 @@
1+
log_level = 'INFO'
2+
load_from = None
3+
resume_from = None
4+
dist_params = dict(backend='nccl')
5+
workflow = [('train', 1)]
6+
checkpoint_config = dict(interval=10)
7+
evaluation = dict(interval=10, metric='mAP', key_indicator='AP')
8+
9+
optimizer = dict(
10+
type='Adam',
11+
lr=5e-4,
12+
)
13+
optimizer_config = dict(grad_clip=None)
14+
# learning policy
15+
lr_config = dict(
16+
policy='step',
17+
warmup='linear',
18+
warmup_iters=500,
19+
warmup_ratio=0.001,
20+
step=[170, 200])
21+
total_epochs = 210
22+
log_config = dict(
23+
interval=50,
24+
hooks=[
25+
dict(type='TextLoggerHook'),
26+
# dict(type='TensorboardLoggerHook')
27+
])
28+
29+
channel_cfg = dict(
30+
num_output_channels=133,
31+
dataset_joints=133,
32+
dataset_channel=[
33+
list(range(133)),
34+
],
35+
inference_channel=list(range(133)))
36+
37+
# model settings
38+
model = dict(
39+
type='TopDown',
40+
pretrained='models/pytorch/imagenet/hrnet_w32-36af842e.pth',
41+
backbone=dict(
42+
type='HRNet',
43+
in_channels=3,
44+
extra=dict(
45+
stage1=dict(
46+
num_modules=1,
47+
num_branches=1,
48+
block='BOTTLENECK',
49+
num_blocks=(4, ),
50+
num_channels=(64, )),
51+
stage2=dict(
52+
num_modules=1,
53+
num_branches=2,
54+
block='BASIC',
55+
num_blocks=(4, 4),
56+
num_channels=(32, 64)),
57+
stage3=dict(
58+
num_modules=4,
59+
num_branches=3,
60+
block='BASIC',
61+
num_blocks=(4, 4, 4),
62+
num_channels=(32, 64, 128)),
63+
stage4=dict(
64+
num_modules=3,
65+
num_branches=4,
66+
block='BASIC',
67+
num_blocks=(4, 4, 4, 4),
68+
num_channels=(32, 64, 128, 256))),
69+
),
70+
keypoint_head=dict(
71+
type='TopDownSimpleHead',
72+
in_channels=32,
73+
out_channels=channel_cfg['num_output_channels'],
74+
num_deconv_layers=0,
75+
extra=dict(final_conv_kernel=1, ),
76+
),
77+
train_cfg=dict(),
78+
test_cfg=dict(
79+
flip_test=True,
80+
post_process=True,
81+
shift_heatmap=True,
82+
unbiased_decoding=True,
83+
modulate_kernel=11),
84+
loss_pose=dict(type='JointsMSELoss', use_target_weight=True))
85+
86+
data_cfg = dict(
87+
image_size=[288, 384],
88+
heatmap_size=[72, 96],
89+
num_output_channels=channel_cfg['num_output_channels'],
90+
num_joints=channel_cfg['dataset_joints'],
91+
dataset_channel=channel_cfg['dataset_channel'],
92+
inference_channel=channel_cfg['inference_channel'],
93+
soft_nms=False,
94+
nms_thr=1.0,
95+
oks_thr=0.9,
96+
vis_thr=0.2,
97+
bbox_thr=1.0,
98+
use_gt_bbox=False,
99+
image_thr=0.0,
100+
bbox_file='data/coco/person_detection_results/'
101+
'COCO_val2017_detections_AP_H_56_person.json',
102+
)
103+
104+
train_pipeline = [
105+
dict(type='LoadImageFromFile'),
106+
dict(type='TopDownRandomFlip', flip_prob=0.5),
107+
dict(
108+
type='TopDownHalfBodyTransform',
109+
num_joints_half_body=8,
110+
prob_half_body=0.3),
111+
dict(
112+
type='TopDownGetRandomScaleRotation', rot_factor=40, scale_factor=0.5),
113+
dict(type='TopDownAffine'),
114+
dict(type='ToTensor'),
115+
dict(
116+
type='NormalizeTensor',
117+
mean=[0.485, 0.456, 0.406],
118+
std=[0.229, 0.224, 0.225]),
119+
dict(type='TopDownGenerateTarget', sigma=3, unbiased_encoding=True),
120+
dict(
121+
type='Collect',
122+
keys=['img', 'target', 'target_weight'],
123+
meta_keys=[
124+
'image_file', 'joints_3d', 'joints_3d_visible', 'center', 'scale',
125+
'rotation', 'bbox_score', 'flip_pairs'
126+
]),
127+
]
128+
129+
val_pipeline = [
130+
dict(type='LoadImageFromFile'),
131+
dict(type='TopDownAffine'),
132+
dict(type='ToTensor'),
133+
dict(
134+
type='NormalizeTensor',
135+
mean=[0.485, 0.456, 0.406],
136+
std=[0.229, 0.224, 0.225]),
137+
dict(
138+
type='Collect',
139+
keys=[
140+
'img',
141+
],
142+
meta_keys=[
143+
'image_file', 'center', 'scale', 'rotation', 'bbox_score',
144+
'flip_pairs'
145+
]),
146+
]
147+
148+
test_pipeline = val_pipeline
149+
150+
data_root = 'data/coco'
151+
data = dict(
152+
samples_per_gpu=64,
153+
workers_per_gpu=2,
154+
train=dict(
155+
type='TopDownCocoWholeBodyDataset',
156+
ann_file=f'{data_root}/annotations/coco_wholebody_train_v1.0.json',
157+
img_prefix=f'{data_root}/train2017/',
158+
data_cfg=data_cfg,
159+
pipeline=train_pipeline),
160+
val=dict(
161+
type='TopDownCocoWholeBodyDataset',
162+
ann_file=f'{data_root}/annotations/coco_wholebody_val_v1.0.json',
163+
img_prefix=f'{data_root}/val2017/',
164+
data_cfg=data_cfg,
165+
pipeline=val_pipeline),
166+
test=dict(
167+
type='TopDownCocoWholeBodyDataset',
168+
ann_file=f'{data_root}/annotations/coco_wholebody_val_v1.0.json',
169+
img_prefix=f'{data_root}/val2017/',
170+
data_cfg=data_cfg,
171+
pipeline=val_pipeline),
172+
)

0 commit comments

Comments
 (0)