LINCellularNeuroscience/VAME

"check_video=True" throws error

roessler-f opened this issue · 1 comments

Hi,

Sorry for bothering again, but I have an issue with the visualisation of the egocentric alignment of my data. When I run

vame.egocentric_alignment(config, pose_ref_index=[0,10], use_video=True, video_format='.mp4', check_video=True)

I get the following error message:

File "C:\Users\Hackerman\anaconda3\envs\VAME\lib\site-packages\vame-1.0-py3.7.egg\vame\util\align_egocentrical.py", line 317, in egocentric_alignment
File "C:\Users\Hackerman\anaconda3\envs\VAME\lib\site-packages\vame-1.0-py3.7.egg\vame\util\align_egocentrical.py", line 293, in alignment
File "C:\Users\Hackerman\anaconda3\envs\VAME\lib\site-packages\vame-1.0-py3.7.egg\vame\util\align_egocentrical.py", line 239, in play_aligned_video
IndexError: list index out of range

Do you know how I could fix this issue?

Thanks a lot for your help!

Best,
Fabienne

How many labeled body parts do you have? The code is only set up to handle 8. On line 239 (the first line in your error traceback), the function play_aligned_video has this code:

def play_aligned_video(a, n, frame_count):
    colors = [(255,0,0),(0,255,0),(0,0,255),(255,255,0),(255,0,255),(0,255,255),(0,0,0),(255,255,255)]

So there are color mappings for 8 body parts, and if you have more than that you get index out of range. In my fork of this I've expanded this to 14 by modifying the code to:

    colors = [(255,0,0),(0,255,0),(0,0,255),
              (255,255,0),(255,0,255),(0,255,255),
              (0,0,0),(255,255,255), (255, 128, 0),
              (255, 153, 255), (170, 86, 255), (97, 237, 97),
              (62, 142, 142), (232,232,44)]

You can check out my fork of this repo for other bug fixes as well...