kennymckormick / pyskl

A toolbox for skeleton-based action recognition.
Apache License 2.0
911 stars 175 forks source link

GeneratePoseTarget return horizontal heatmap image #240

Open TonsonP opened 3 months ago

TonsonP commented 3 months ago

Hello everyone

Currently, I'm experiments on PoseC3D and trying to create some inference services to check results from skeleton keypoints.

inference_pipeline = [
    dict(type='GeneratePoseTarget', with_kp=False, with_limb=True, double=False, left_kp=left_kp, right_kp=right_kp),
    ]

def vis_heatmaps(heatmaps, channel=-1, ratio=8):
    # if channel is -1, draw all keypoints / limbs on the same map
    import matplotlib.cm as cm
    heatmaps = [x.transpose(1, 2, 0) for x in heatmaps]
    h, w, _ = heatmaps[0].shape
    newh, neww = int(h * ratio), int(w * ratio)

    if channel == -1:
        heatmaps = [np.max(x, axis=-1) for x in heatmaps]
    cmap = cm.viridis
    heatmaps = [(cmap(x)[..., :3] * 255).astype(np.uint8) for x in heatmaps]
    heatmaps = [cv2.resize(x, (neww, newh)) for x in heatmaps]
    return heatmaps

10

First, I put my input keypoints (1, 48, 17, 2) into inference pipeline which only consists of GeneratePoseTarget, then I visualize the heatmap using the functions provided in visualize_heatmap_volume.ipynb files. I found out that all of the heatmap are in horizontal instead of vertical as displayed in the picture. Is this behaviours to be expected or did I do something incorrectly?

I have attached the fake_anno dict that I used to test this. https://drive.google.com/file/d/1_qCEwMjrjRhL5TOC3qAyXGIkzy-owEJS/view?usp=sharing

Any help is appreciate.