LINCellularNeuroscience/VAME

vame.egocentric_alignment - array of sample points is empty

SusanL82 opened this issue · 2 comments

Hi VAME team,
I'm running into some problems with the egocentric_alignment function.
I've tried to use the solutions mentioned in issue #77 , but I keep running into the same issue: ValueError: array of sample points is empty.

I'm trying to use the nose and tailbase coordinates for egocentric aligment, and detection likelihoods for both are generally ok. I've tried to run the function with pose_confidence set to 0.99, 0.9 and also 0.1, but I keep running into the same error (see below).
I thought the issue might be due to cropping settings instead, but changing these doesn't help either.

I've attached one of my .csv files in case that helps.

Susan

My code looks like this:
`import vame

project='ObjectRecogTest'
vid_directory = 'E:/Cognition Sepsis Behav Exp/4 Object Recognition/3mo group 1/4DOT1/'
work_directory = 'E:/Cognition Sepsis Behav Exp/4 Object Recognition/vametest/'

videos = [vid_directory+'rat9_4DOT1_empty.mp4',vid_directory+'rat9_4DOT1_train.mp4',vid_directory+'rat9_4DOT1_test.mp4']

Initialize project

config = vame.init_new_project(project=project, videos=videos, working_directory=work_directory, videotype='.mp4')

pose_ref_index: list of reference coordinate indices for alignment (model has 12 body parts, use nose (0) and tailbase(9) )

vame.egocentric_alignment(config, pose_ref_index=[0,9], crop_size=(300,300), use_video=False, video_format='.mp4', check_video=False)`

And the result is this:

vame.egocentric_alignment(config, pose_ref_index=[0,9], crop_size=(300,300), use_video=False, video_format='.mp4', check_video=False)
Aligning data rat9_4DOT1_empty, Pose confidence value: 0.90
Traceback (most recent call last):

File "C:\Users\susan\AppData\Local\Temp\ipykernel_14216\562814285.py", line 1, in
vame.egocentric_alignment(config, pose_ref_index=[0,9], crop_size=(300,300), use_video=False, video_format='.mp4', check_video=False)

File "C:\Users\susan\VAME\vame\util\align_egocentrical.py", line 317, in egocentric_alignment
confidence, use_video=use_video, check_video=check_video)

File "C:\Users\susan\VAME\vame\util\align_egocentrical.py", line 290, in alignment
confidence, pose_flip_ref, bg, frame_count, use_video)

File "C:\Users\susan\VAME\vame\util\align_egocentrical.py", line 155, in align_mouse
i = interpol(i)

File "C:\Users\susan\VAME\vame\util\align_egocentrical.py", line 87, in interpol
y[0][nans]= np.interp(x(nans), x(~nans), y[0][~nans])

File "<array_function internals>", line 6, in interp

File "C:\Users\susan\anaconda3\envs\VAME\lib\site-packages\numpy\lib\function_base.py", line 1439, in interp
return interp_func(x, xp, fp, left, right)

ValueError: array of sample points is empty

rat9_4DOT1_empty.csv

I ended up changing my approach a bit and don't get this error anymore.