Keypoints_only cannot draw skeleton in create_labeled_video

Hi,

I’m trying to create labeled video with keypoints_only = True.
I’m getting the following error when I set draw_skeleton = True:
/usr/local/lib/python3.7/dist-packages/deeplabcut/utils/make_labeled_video.py in create_video_with_keypoints_only()
728 colors = cmap(map_)
729 scat.set_color(colors)
→ 730 segs = coords[tuple(zip(*tuple([ind_links])))].swapaxes(0, 1) if ind_links else
731 coll = LineCollection(segs, colors=skeleton_color, alpha=alpha)
732 ax.add_collection(coll)

IndexError: too many indices for array

Setting keypoints_only = False, or setting draw_skeleton = False will both work just fine.

Changing the body parts to display or individuals to a subset won’t solve the issue.

Anyone had this issue before?

keypoints_only=True means that you want only the labels without skeleton while draw_skeleton=True means you want to draw the skeleton connecting those keypoints. Giving both True would mean that you want to draw skeleton but don’t want to draw skeleton which is nonsensical.

draw_skeleton=True already plots the keypoints so there is no point in setting keypoints_only=True

Thanks for the response. But I’m afraid that’s not the case. In the function create_video_with_keypoints_only, I think these lines are doing the job of connecting the keypoints with skeletons:

    segs = coords[tuple(zip(*tuple([ind_links])))].swapaxes(0, 1) if ind_links else []
    coll = LineCollection(segs, colors=skeleton_color, alpha=alpha)
    ax.add_collection(coll)

But seems there is something wrong the size of the array that I can’t figure out.

Sorry, I assumed badly that it’s for plotting while it’s for ommiting the video. My bad!

Anyway, I tried to reproduce and gotten the same error. Although having only one connections doesn’t produce an error it doesn’t work as intended, i.e. no skeleton (no single line) is produced.

Having more than two connections error changed to IndexError: too many indices for array produced at the same line (730 of make_labeled_video.py)

Will get into reading the code and maybe I can find what’s going on

Do you know if this worked before? If it did, maybe it’s due to the changes in the way skeleton is specified in config. If I’ll have time, I’ll check this on an older version of DLC

Hey @tzeriver, please open an issue on GitHub if you can, so that I or others have it on their radar and think of a fix :slight_smile:

Posted on Github. Thank you.