Closed ChenZhenGui closed 1 year ago
Hi, thanks for using MMPose. Do you activate the PoseVisualizationHook
during validation? And could you please provide the information about the config you use? It will help us check this problem
已收到,谢谢
Hi, thanks for using MMPose. Do you activate the
PoseVisualizationHook
during validation? And could you please provide the information about the config you use? It will help us check this problem
this is my config: base = ['../../../base/default_runtime.py',] 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 ])
train_cfg = dict(max_epochs=300, val_interval=50)
optim_wrapper = dict(optimizer=dict( type='AdamW', lr=5e-4, ))
resume = True
load_from = None
log_config = dict( interval=50, hooks=[ dict(type='TextLoggerHook'), dict(type='TensorboardLoggerHook') ])
param_scheduler = [ dict( type='LinearLR', begin=0, end=500, start_factor=0.001, by_epoch=False), # warm-up dict( type='MultiStepLR', begin=0, end=210, milestones=[170, 240], gamma=0.1, by_epoch=True) ]
auto_scale_lr = dict(base_batch_size=512)
default_hooks = dict(checkpoint=dict(save_best='coco/AP', rule='greater'))
codec = dict( type='MSRAHeatmap', input_size=(192, 256), heatmap_size=(48, 64), sigma=2)
model = dict( type='TopdownPoseEstimator', data_preprocessor=dict( type='PoseDataPreprocessor', mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], bgr_to_rgb=True), backbone=dict( type='MyMobileViT', model_cfg={'layer1': {'out_channels': 32, 'expand_ratio': 4, 'num_blocks': 1, 'stride': 1, 'block_type': 'mv2', 'dropout': 0.1, 'ffn_dropout': 0.0, 'attn_dropout': 0.0}, 'layer2': {'out_channels': 64, 'expand_ratio': 4, 'num_blocks': 3, 'stride': 2, 'block_type': 'mv2', 'dropout': 0.1, 'ffn_dropout': 0.0, 'attn_dropout': 0.0}, 'layer3': {'out_channels': 96, 'transformer_channels': 144, 'ffn_dim': 288, 'transformer_blocks': 2, 'patch_h': 2, 'patch_w': 2, 'stride': 2, 'mv_expand_ratio': 4, 'num_heads': 4, 'block_type': 'mobilevit', 'dropout': 0.1, 'ffn_dropout': 0.0, 'attn_dropout': 0.0}, 'layer4': {'out_channels': 128, 'transformer_channels': 192, 'ffn_dim': 384, 'transformer_blocks': 4, 'patch_h': 2, 'patch_w': 2, 'stride': 2, 'mv_expand_ratio': 4, 'num_heads': 4, 'block_type': 'mobilevit', 'dropout': 0.1, 'ffn_dropout': 0.0, 'attn_dropout': 0.0}, 'layer5': {'out_channels': 160, 'transformer_channels': 240, 'ffn_dim': 480, 'transformer_blocks': 3, 'patch_h': 2, 'patch_w': 2, 'stride': 2, 'mv_expand_ratio': 4, 'num_heads': 4, 'block_type': 'mobilevit', 'dropout': 0.1, 'ffn_dropout': 0.0, 'attn_dropout': 0.0}, 'last_layer_exp_factor': 4, 'cls_dropout': 0.1}, ), head=dict( type='TopdownHeatmapSimpleHead', in_channels=640, out_channels=channel_cfg['num_output_channels'], loss_keypoint=dict(type='KeypointMSELoss', use_target_weight=True), decoder=codec), test_cfg=dict( flip_test=True, flip_mode='heatmap', shift_heatmap=True, output_heatmaps=True ))
dataset_type = 'CocoDataset' data_mode = 'topdown' data_root = '/data/zgchen/ViTPose/tools/data/coco/'
train_pipeline = [ dict(type='LoadImage', file_client_args={{base.file_client_args}}), dict(type='GetBBoxCenterScale'), dict(type='RandomFlip', direction='horizontal'), dict(type='RandomHalfBody'), dict(type='RandomBBoxTransform'), dict(type='TopdownAffine', input_size=codec['input_size']), dict(type='GenerateTarget', target_type='heatmap', encoder=codec), dict(type='PackPoseInputs') ] val_pipeline = [ dict(type='LoadImage', file_client_args={{base.file_client_args}}), dict(type='GetBBoxCenterScale'), dict(type='TopdownAffine', input_size=codec['input_size']), dict(type='PackPoseInputs'), ]
train_dataloader = dict( batch_size=48, num_workers=2, persistent_workers=True, sampler=dict(type='DefaultSampler', shuffle=True), dataset=dict( type=dataset_type, data_root=data_root, data_mode=data_mode, ann_file='annotations/person_keypoints_train2017.json', data_prefix=dict(img='train2017/'), pipeline=train_pipeline, )) val_dataloader = dict( batch_size=48, num_workers=2, persistent_workers=True, drop_last=False, sampler=dict(type='DefaultSampler', shuffle=False, round_up=False), dataset=dict( type=dataset_type, data_root=data_root, data_mode=data_mode, ann_file='annotations/person_keypoints_val2017.json', bbox_file='/data/zgchen/ViTPose/tools/data/coco/person_detection_results/' 'COCO_val2017_detections_AP_H_56_person.json', data_prefix=dict(img='val2017/'), test_mode=True, pipeline=val_pipeline, )) test_dataloader = val_dataloader
val_evaluator = dict( type='CocoMetric', ann_file=data_root + 'annotations/person_keypoints_val2017.json') test_evaluator = val_evaluator
when I try to test the visualization,program error:img_path = data_batch[0]['data_samples'].get('img_path') KeyError: 0 then I try to debug and change data_batch[0]['data_samples'].get('img_path') to data_batch['data_samples'][0].get('img_path'),it works,but have new problem like my question above
After changing,my verification image becomes like this:
The reason for this problem is that the output heatmap is not aligned with the bounding box on the original image. Thank you for pointing it out.
Could you please add
data_sample = merge_data_samples([data_sample])
after this line and check the result?
It worked! thank you very much for your help!
Nice. Would you like to raise a PR to fix this problem?
well,I don't know much about that function, let me try it now
Thanks for your contribution! Here is a step-by-step guideline which might be helpful
thank you,and It would be better if there is a Chinese version
By the way, does this modified place need to be commit together?
By the way, does this modified place need to be commit together?
Yes, please change it together. The Chinese version of guideline is added in the above page
hello ,I'm trying to push my code, and I'm getting this error halfway through, how can I fix it?
You could try the following steps:
git remote add origin git@github.com:ChenZhenGui/mmpose.git
if fail, execute
git remote set-url origin git@github.com:ChenZhenGui/mmpose.git
Thanks a lot, but it doesn't seem to pick up dev-1.x branch
Hi @ChenZhenGui, could you please check if you successfully commit the changes and push the commit?
git status
mmpose/engine/hooks/visualization_hook.py
does not appear, then execute git log
and check if you are the author of the latest (top) commitmmpose/engine/hooks/visualization_hook.py
appears, then git add mmpose/engine/hooks/visualization_hook.py
git commit -m 'fix visualization hook' --no-verify
git log
and check if you are the author of the latest (top) commitIf you find you are the author of the latest commit, then you could push the commit with git push origin fix-visualization-hook
I re-created a new branch and successfully submitted it to the dev-1.x branch, please check if my steps are correct
Is it done?
Yes, PR #1800 has been merged into MMPose dev-1.x branch, and will be part of the next release. Thanks again for your help! We will close this issue now and feel free to re-open it or submit a new one if there are further questions.
When I run runner.val , it show :"UserWarning: Since the spatial dimensions of overlaid_image: (488, 640) and featmap: torch.Size([64, 48]) are not same, the feature map will be interpolated. This may cause mismatch problems !" waht's my problem