Skip to content

Cannot play track demo with non-COCO format keypoints in oks_iou mode #1502

@daixinghome

Description

@daixinghome

Describe the bug

In the latest commit, I find that the track demo script can only make visualization of keypoints defined by COCO. If I use the other definition with different keypoints number (not equal to 17), it will always fail.

Reproduction

For example, if you run the following code in default environment, you cannot be success.

python3 demo/bottom_up_pose_tracking_demo.py \
    configs/body/2d_kpt_sview_rgb_img/associative_embedding/aic/higherhrnet_w32_aic_512x512.py \
    https://download.openmmlab.com/mmpose/bottom_up/higher_hrnet32_aic_512x512-9a674c33_20210130.pth \
    --kpt-thr 0.6 \
    --smooth \
    --use-oks-tracking \
    --video-path demo/resources/demo.mp4 \
    --out-video-root vis_results

Error traceback

  File "demo/bottom_up_pose_tracking_demo.py", line 208, in <module>
    main()
  File "demo/bottom_up_pose_tracking_demo.py", line 166, in main
    pose_results, next_id = get_track_id(
  File "/home/xing.dai/workspace/mmpose/mmpose/apis/inference_tracking.py", line 226, in get_track_id
    track_id, results_last, match_result = _track(
  File "/home/xing.dai/workspace/mmpose/mmpose/apis/inference_tracking.py", line 106, in _track_by_oks
    oks_score = oks_iou(pose, pose_last, area, area_last, sigmas=sigmas)
  File "/home/xing.dai/workspace/mmpose/mmpose/core/post_processing/nms.py", line 81, in oks_iou
    e = (dx**2 + dy**2) / vars / ((a_g + a_d[n_d]) / 2 + np.spacing(1)) / 2
ValueError: operands could not be broadcast together with shapes (14,) (17,)

Bug fix

The key error is that in the code of oks_iou, no sigmas is specified in the tracking code:

track_id, results_last, match_result = _track(result, results_last,

So it always use default sigmas of COCO dataset.

def oks_iou(g, d, a_g, a_d, sigmas=None, vis_thr=None):

If we get the sigmas from DatasetInfo and pass the variable to oks_iou function, it will work.
If it's ok, i would like to create a PR to fix the bug in these days :).

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions