dattalab / keypoint-moseq

https://keypoint-moseq.readthedocs.io
Other
63 stars 25 forks source link

issue importing keypoint data from a separate folder. #147

Closed quemelabune closed 2 months ago

quemelabune commented 2 months ago

I just ran into an error loading a set of analyzed data from a folder containing videos already scored by deeplabcut but stored in a different folder from the "videos" folder in the deeplabcut project.

when running

kpms.noise_calibration(project_dir, coordinates, confidences, **config())

I get an error saying no video associated with the .h5 file is found, even if the video is in the same folder.

The issue was solved by moving the videos and the .h5 file to the video folder inside the deeplabcut project. Just wondering if this is a specific issue with kpms or if there was a path line that I did not edit that did had to be corrected.

calebweinreb commented 2 months ago

Hi, thanks for raising this issue! The basic logic of path management in kpms is that you specify a "video_dir" in the kpms config, and kpms will look in this directory to find videos that match the keypoint data (specifically, for each key in the coordinates dict, kpms will look for a video name that appears as prefix within the key string).

I didn't follow all the details of your specific scenario, but given the expected behavior described above, do you think there is some kind of error happening? Or do you think the path logic could be explained better in the docs/tutorial?

quemelabune commented 2 months ago

Hi Caleb. I see, it would be useful in the tutorial to add that the path for the directory "video-dir" should be edited in the kpms config file. And not just specified while loading the data using:

keypoint_data_path = 'video directory path' coordinates, confidences, bodyparts = kpms.load_keypoints(keypoint_data_path, 'deeplabcut')

I changed the path in the config file and it fixed the issue. Now I can load data from any folder and as long as the path it's correct it works.

Thanks