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 brower datasets with OpenPose visualized format? #2760

Open liming-ai opened 1 year ago

liming-ai commented 1 year ago

What is the feature?

Brower datasets with OpenPose visualized format?

Any other context?

I tried to run

python3 tools/misc/browse_dataset.py \
    configs/body_2d_keypoint/rtmpose/coco/rtmpose-l_8xb256-420e_coco-256x192.py \
    --output-dir vis --not-show --mode original --cfg-options skeleton-style=openpose

But the visualized results are different from openpose visualizations

Ben-Louis commented 1 year ago

The script browse_dataset.py has not supported argument skeleton_style. Please add skeleton_style="openpose" at https://github.com/open-mmlab/mmpose/blob/6d10b2ec81da7e252016b3154c7fdb46c403ecd8/tools/misc/browse_dataset.py#L100 and https://github.com/open-mmlab/mmpose/blob/6d10b2ec81da7e252016b3154c7fdb46c403ecd8/tools/misc/browse_dataset.py#L151 manually

liming-ai commented 1 year ago

The script browse_dataset.py has not supported argument skeleton_style. Please add skeleton_style="openpose" at

https://github.com/open-mmlab/mmpose/blob/6d10b2ec81da7e252016b3154c7fdb46c403ecd8/tools/misc/browse_dataset.py#L100

and https://github.com/open-mmlab/mmpose/blob/6d10b2ec81da7e252016b3154c7fdb46c403ecd8/tools/misc/browse_dataset.py#L151

manually

Thanks for your kindly help!

liming-ai commented 1 year ago

Hi @Ben-Louis,

The instructions work for the COCO dataset. After that, I tried to use the same workflow to browse the HumanArt dataset by replacing configs, but some strange error happened.

Here is my command:

python3 tools/misc/browse_dataset.py \
    configs/body_2d_keypoint/topdown_heatmap/humanart/td-hm_hrnet-w32_8xb64-210e_humanart-256x192.py \
    --output-dir visualized_pose/humanart/train --mode original

And the error is:

  File "/home/chenchen/liming/code/mmpose/tools/misc/browse_dataset.py", line 167, in <module>
    main()
  File "/home/chenchen/liming/code/mmpose/tools/misc/browse_dataset.py", line 151, in main
    visualizer.add_datasample(
  File "/home/chenchen/anaconda3/envs/reward_control/lib/python3.10/site-packages/mmengine/dist/utils.py", line 401, in wrapper
    return func(*args, **kwargs)
  File "/home/chenchen/anaconda3/envs/reward_control/lib/python3.10/site-packages/mmpose/visualization/local_visualizer.py", line 515, in add_datasample
    gt_img_data = self._draw_instances_kpts(
  File "/home/chenchen/anaconda3/envs/reward_control/lib/python3.10/site-packages/mmpose/visualization/local_visualizer.py", line 302, in _draw_instances_kpts
    raise ValueError(
ValueError: the length of kpt_color (17) does not matches that of keypoints (18)

I have no idea why this error happened, since both COCO and HumanArt only have 17 keypoints. I also print the shape with data_sample.gt_instances.keypoints.shape, and the results are both (1, 17, 2) for COCO and HumanArt

Ben-Louis commented 1 year ago

Currently, the openpose style visualization only supports skeleton in COCO and COCO-Wholebody datasets https://github.com/open-mmlab/mmpose/blob/6d10b2ec81da7e252016b3154c7fdb46c403ecd8/mmpose/visualization/local_visualizer.py#L157-L169

liming-ai commented 1 year ago

Thanks for your reply. Could you please tell me how I should modify it to visualize these poses in the openpose style? I would appreciate it if you could give me some guidance.