open-mmlab / mmpose

OpenMMLab Pose Estimation Toolbox and Benchmark.
https://mmpose.readthedocs.io/en/latest/
Apache License 2.0
5.84k stars 1.25k forks source link

how to run edpose #3101

Open shockjiang opened 2 months ago

shockjiang commented 2 months ago

Prerequisite

Environment

I download edpose cfg and pth via:

` mim download mmpose --config edpose_res50_8xb2-50e_coco-800x1333 --dest abc

export RES_ROOT=abc python demo/image_demo.py \ tests/data/coco/000000000785.jpg \ ${RES_ROOT}/edpose_res50_8xb2-50e_coco-800x1333.py \ ${RES_ROOT}/edpose_res50_coco_3rdparty.pth \ --out-file ${RES_ROOT}/vis_results_edpose.jpg \ --draw-heatmap `

but I got warning: nexpected key in source state_dict: neck.convs.0.conv.bias, neck.convs.1.conv.bias, neck.convs.2.conv.bias, neck.extra_convs.0.conv.bias

and the visaulized image is not right. only bbox is found: image

I wonder how to fix it? Also, it is possible to train my own EDpose with my own dataset?

thank you!

Reproduces the problem - code sample

from mmpose.apis import inference_topdown, init_model from mmpose.utils import register_all_modules import pdb

register_all_modules()

res_root = 'abc' config_file = f'{res_root}/td-hm_hrnet-w48_8xb32-210e_coco-256x192.py' checkpoint_file = f'{res_root}/td-hm_hrnet-w48_8xb32-210e_coco-256x192-0e67c616_20220913.pth'

config_file = f'{res_root}/edpose_res50_8xb2-50e_coco-800x1333.py' checkpoint_file = f'{res_root}/edpose_res50_coco_3rdparty.pth'

model = init_model(config_file, checkpoint_file, device='cpu') # or device='cuda:0'

img_fp = r'tests/data/coco/000000000785.jpg'

please prepare an image with person

results = inference_topdown(model, img_fp)

type(results)=list, len(results)=1,

type(results[0])=<class 'mmpose.structures.pose_data_sample.PoseDataSample'>,

results[0].keys()=['gt_instances', 'gt_instance_labels', 'pred_instances']

results[0].pred_instances.keypoints

pdb.set_trace()

Reproduces the problem - command or script

` mim download mmpose --config edpose_res50_8xb2-50e_coco-800x1333 --dest abc

export RES_ROOT=abc python demo/image_demo.py \ tests/data/coco/000000000785.jpg \ ${RES_ROOT}/edpose_res50_8xb2-50e_coco-800x1333.py \ ${RES_ROOT}/edpose_res50_coco_3rdparty.pth \ --out-file ${RES_ROOT}/vis_results_edpose.jpg \ --draw-heatmap `

Reproduces the problem - error message

Loads checkpoint by local backend from path: abc/edpose_res50_coco_3rdparty.pth /home/jiangxiaoke/anaconda3/lib/python3.11/site-packages/mmengine/runner/checkpoint.py:347: FutureWarning: You are using torch.load with weights_only=False (the current default value), which uses the default pickle module implicitly. It is possible to construct malicious pickle data which will execute arbitrary code during unpickling (See https://github.com/pytorch/pytorch/blob/main/SECURITY.md#untrusted-models for more details). In a future release, the default value for weights_only will be flipped to True. This limits the functions that could be executed during unpickling. Arbitrary objects will no longer be allowed to be loaded via this mode unless they are explicitly allowlisted by the user via torch.serialization.add_safe_globals. We recommend you start setting weights_only=True for any use case where you don't have full control of the loaded file. Please open an issue on GitHub for any issues related to this experimental feature. checkpoint = torch.load(filename, map_location=map_location) The model and loaded state dict do not match exactly

unexpected key in source state_dict: neck.convs.0.conv.bias, neck.convs.1.conv.bias, neck.convs.2.conv.bias, neck.extra_convs.0.conv.bias

Additional information

No response

shockjiang commented 2 months ago

I used bottomup_demo.py to infer, which seems to show right keypoint on visulization.

    python demo/bottomup_demo.py \
        ${RES_ROOT}/edpose_res50_8xb2-50e_coco-800x1333.py \
        ${RES_ROOT}/edpose_res50_coco_3rdparty.pth \
        --input tests/data/coco/000000000785.jpg \
        --output-root ${RES_ROOT} \
        --draw-heatmap

but still:

thx!