forked from open-mmlab/mmpose
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add rsn backbone, head and pre-processing (open-mmlab#221)
* Add rsn * Add unit test * Modification * Some corrections * Corrections * Correction in top_down_transform.py * Correction in top_down_transform.py * Add mspn * unit test for mspn * remove mspn * rename mspn_head to msmu_head * Add unit test for backbone and head * fix a bug in rsn.py * Add rsn * Add unit test * Modification * Some corrections * Corrections * Correction in top_down_transform.py * Correction in top_down_transform.py * Add mspn * unit test for mspn * remove mspn * rename mspn_head to msmu_head * Add unit test for backbone and head * fix a bug in rsn.py * rm unnecessary codes * add comment for 3-sigma rule * fix some bugs Co-authored-by: jinsheng <jinsheng@sensetime.com>
- Loading branch information
Showing
10 changed files
with
1,286 additions
and
37 deletions.
There are no files selected for viewing
157 changes: 157 additions & 0 deletions
157
configs/top_down/rsn/coco/single_ctf_rsn18_coco_256x192.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,157 @@ | ||
log_level = 'INFO' | ||
load_from = None | ||
resume_from = None | ||
dist_params = dict(backend='nccl') | ||
workflow = [('train', 1)] | ||
checkpoint_config = dict(interval=10) | ||
evaluation = dict(interval=10, metric='mAP', key_indicator='AP') | ||
|
||
optimizer = dict( | ||
type='Adam', | ||
lr=5e-3, | ||
) | ||
optimizer_config = dict(grad_clip=None) | ||
# learning policy | ||
lr_config = dict( | ||
policy='poly', | ||
warmup='linear', | ||
warmup_iters=500, | ||
warmup_ratio=0.001, | ||
min_lr=5e-5) | ||
total_epochs = 210 | ||
log_config = dict( | ||
interval=50, hooks=[ | ||
dict(type='TextLoggerHook'), | ||
]) | ||
|
||
channel_cfg = dict( | ||
num_output_channels=17, | ||
dataset_joints=17, | ||
dataset_channel=[ | ||
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16], | ||
], | ||
inference_channel=[ | ||
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 | ||
]) | ||
|
||
# model settings | ||
model = dict( | ||
type='TopDown', | ||
pretrained=None, | ||
backbone=dict( | ||
type='RSN', | ||
unit_channels=256, | ||
num_stages=1, | ||
num_units=4, | ||
num_blocks=[2, 2, 2, 2], | ||
num_steps=4, | ||
norm_cfg=dict(type='BN')), | ||
keypoint_head=dict( | ||
type='TopDownMSMUHead', | ||
out_shape=(64, 48), | ||
unit_channels=256, | ||
out_channels=channel_cfg['num_output_channels'], | ||
num_stages=1, | ||
num_units=4, | ||
use_prm=False, | ||
norm_cfg=dict(type='BN')), | ||
train_cfg=dict(num_units=4, loss_weights=[0.25] * 3 + [1]), | ||
test_cfg=dict( | ||
flip_test=True, | ||
post_process=True, | ||
shift_heatmap=True, | ||
unbiased_decoding=False, | ||
modulate_kernel=11), | ||
loss_pose=[dict(type='JointsMSELoss', use_target_weight=True)] * 3 + | ||
[dict(type='JointsOHKMMSELoss', use_target_weight=True)]) | ||
|
||
data_cfg = dict( | ||
image_size=[192, 256], | ||
heatmap_size=[48, 64], | ||
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, | ||
bbox_thr=1.0, | ||
use_gt_bbox=False, | ||
image_thr=0.0, | ||
bbox_file='data/coco/person_detection_results/' | ||
'COCO_val2017_detections_AP_H_56_person.json', | ||
) | ||
|
||
train_pipeline = [ | ||
dict(type='LoadImageFromFile'), | ||
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', | ||
kernel=[(11, 11), (9, 9), (7, 7), (5, 5)], | ||
encoding='Megvii'), | ||
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='LoadImageFromFile'), | ||
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 | ||
|
||
data_root = 'data/coco' | ||
data = dict( | ||
samples_per_gpu=32, | ||
workers_per_gpu=2, | ||
train=dict( | ||
type='TopDownCocoDataset', | ||
ann_file=f'{data_root}/annotations/person_keypoints_train2017.json', | ||
img_prefix=f'{data_root}/train2017/', | ||
data_cfg=data_cfg, | ||
pipeline=train_pipeline), | ||
val=dict( | ||
type='TopDownCocoDataset', | ||
ann_file=f'{data_root}/annotations/person_keypoints_val2017.json', | ||
img_prefix=f'{data_root}/val2017/', | ||
data_cfg=data_cfg, | ||
pipeline=val_pipeline), | ||
test=dict( | ||
type='TopDownCocoDataset', | ||
ann_file=f'{data_root}/annotations/person_keypoints_val2017.json', | ||
img_prefix=f'{data_root}/val2017/', | ||
data_cfg=data_cfg, | ||
pipeline=val_pipeline), | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.