dattalab / keypoint-moseq

https://keypoint-moseq.readthedocs.io
Other
64 stars 26 forks source link

Load Data error: "keypoint_moseq' has no attribute 'load_keypoints" #70

Closed ryanschwark closed 1 year ago

ryanschwark commented 1 year ago

Hi all,

We've run into a little error during the Load Data step in the tutorial notebook (the notebook is the most up-to date version from GitHub). We enter the following info into the cell:

keypoint_data_path = 'Ana tutorial moseq H5s and videos' # can be a file, a directory, or a list of files coordinates, confidences, bodyparts = kpms.load_keypoints(keypoint_data_path, 'sleap') data, labels = kpms.format_data(coordinates, confidences=confidences, **config())

When we run this cell, we get the following error:

AttributeError Traceback (most recent call last) Cell In[17], line 3 1 # load data (e.g. from DeepLabCut) 2 keypoint_data_path = 'Ana tutorial moseq H5s and videos' # can be a file, a directory, or a list of files ----> 3 coordinates, confidences, bodyparts = kpms.load_keypoints(keypoint_data_path, 'sleap') 5 # format data for modeling 6 data, labels = kpms.format_data(coordinates, confidences=confidences, **config()) AttributeError: module 'keypoint_moseq' has no attribute 'load_keypoints'

Any idea what might be causing this error? Thanks so much!

calebweinreb commented 1 year ago

What happens if you print kpms.__version__?

ryanschwark commented 1 year ago

Hi Caleb,

When I enter the command print (kpms.version) in the Jupyter Notebook, I get 0.1.2+81.gc8e9f07

Is this version out-of-date? Thanks!

calebweinreb commented 1 year ago

Yes it should be 0.1.5. You could run pip install -U git+https://github.com/dattalab/keypoint-moseq@dev

ryanschwark commented 1 year ago

Thanks! I updated Keypoint MoSeq to 0.1.5. but now it looks like I'm getting a new error where it says that "No files with extensions ['.h5', '.hdf5', '.slp'] found". In the folder I'm using, there are multiple .H5 files present. Any idea what might be causing this error?

AssertionError Traceback (most recent call last) Cell In[9], line 3 1 # load data (e.g. from DeepLabCut) 2 keypoint_data_path = 'Ana tutorial moseq H5s and videos' # can be a file, a directory, or a list of files ----> 3 coordinates, confidences, bodyparts = kpms.load_keypoints(keypoint_data_path, 'sleap') 5 # format data for modeling 6 data, labels = kpms.format_data(coordinates, confidences=confidences, **config())

File ~\miniconda3\envs\keypoint_moseq\lib\site-packages\keypoint_moseq\io.py:990, in load_keypoints(filepath_pattern, format, extension, recursive, path_sep, path_in_name, remove_extension) 981 loader = { 982 'deeplabcut': _deeplabcut_loader, 983 'sleap': _sleap_loader, 984 'anipose': _anipose_loader, 985 'sleap-anipose': _sleap_anipose_loader 986 }[format] 988 filepaths = list_files_with_exts( 989 filepath_pattern, extensions, recursive=recursive) --> 990 assert len(filepaths)>0, fill( 991 f'No files with extensions {extensions} found for {filepath_pattern}') 993 coordinates,confidences,bodyparts = {},{},None 994 for filepath in tqdm.tqdm(filepaths, desc=f'Loading keypoints'):

AssertionError: No files with extensions ['.h5', '.hdf5', '.slp'] found for Ana tutorial moseq H5s and videos

ryanschwark commented 1 year ago

Update -- I figured out the issue! When I was entering the path information for where my .H5s and videos were stored, I omitted some path info which was required. So originally I had:

keypoint_data_path = 'Ana tutorial moseq H5s and videos' which gave me the error. By changing it to:

keypoint_data_path = 'D:\Ana tutorial moseq H5s and videos' I was able to prevent the error!