Closed ryanschwark closed 1 year ago
Thanks for the heads up! @versey-sherry this is a known bug that was fixed here https://github.com/dattalab/keypoint-moseq/commit/fa19cdb168641765a259a464c6b24d4078a8e358. When you get a chance, can you rebase sherry_updates
to pull in newer commits from main
?
@ryanschwark, once Sherry has updated her branch with the bug fix, you'll need to reinstall the branch and restart the notebook kernel, after which the bug should go away.
Thanks Caleb -- will do!
This should now be fixed in the dev
branch (which includes the bug fix I mentioned + all the new analysis code)
Hi all,
We're at the syllable labeling tool step in the Keypoint MoSeq Analysis Visualization Notebook, and have encountered an interesting error. Thanks for all the help so far and it would be amazing if we could get some insight into this! We can successfully load the SLEAP .H5 files but then encounter the error "cannot convert float NaN to integer". We're trying to generate grid movies, but also get the same issue when we try crowd movies. We use this cell, and then get the following error:
video_dir = 'dlc_project/videos'
keypoint_data_type = 'deeplabcut'
movie_type='grid' # either 'grid' or 'crowd' kpms.label_syllables(project_dir, model_dirname, video_dir, keypoint_data_type, movie_type=movie_type)
BokehJS 3.1.1 successfully loaded. Loading from sleap: 100%|██████████████████████████████████████████████████████████████| 13/13 [00:00<00:00, 17.57it/s] No grid movies found in the directory. Generating grid movies Writing grid movies to model training notebook 6-5-2023\2023_06_05-12_29_03\grid_movies
ValueError Traceback (most recent call last) Cell In[13], line 5 1 # video_dir = 'dlc_project/videos' 2 # keypoint_data_type = 'deeplabcut' 4 movie_type='grid' # either 'grid' or 'crowd' ----> 5 kpms.label_syllables(project_dir, model_dirname, video_dir, keypoint_data_type, movie_type=movie_type)
File ~\miniconda3\envs\keypoint_moseq\lib\site-packages\keypoint_moseq\wrappers.py:74, in label_syllables(project_dir, model_dirname, video_dir, keypoint_data_type, movie_type) 72 if len(grid_movies)==0: 73 print('No grid movies found in the directory. Generating grid movies') ---> 74 generate_grid_movies(name=model_dirname, project_dir=project_dir, coordinates=coordinates, *config_data) 75 # record the movie paths 76 grid_movies=glob(os.path.join(project_dir, model_dirname, 'grid_movies', '.mp4'))
File ~\miniconda3\envs\keypoint_moseq\lib\site-packages\keypoint_moseq\viz.py:856, in generate_grid_movies(results, output_dir, name, project_dir, results_path, video_dir, video_paths, rows, cols, filter_size, pre, post, min_frequency, min_duration, dot_radius, dot_color, quality, window_size, use_reindexed, coordinates, bodyparts, use_bodyparts, sampling_options, video_extension, max_video_size, **kwargs) 852 centroids,headings = filter_centroids_headings( 853 centroids, headings, filter_size=filter_size) 855 if window_size is None: --> 856 window_size = get_grid_movie_window_size( 857 sampled_instances, centroids, headings, 858 coordinates, pre, post) 860 # in practice we may need a smaller window... 861 scaled_window_size = max_video_size/max(rows,cols)
File ~\miniconda3\envs\keypoint_moseq\lib\site-packages\keypoint_moseq\viz.py:666, in get_grid_movie_window_size(sampled_instances, centroids, headings, coordinates, pre, post, pctl, fudge_factor, blocksize) 664 ax_distances = np.max(np.abs(all_trajectories), axis=1) 665 window_size = np.percentile(ax_distances, pctl) fudge_factor 2 --> 666 window_size = int(np.ceil(window_size / blocksize) * blocksize) 667 return window_size
ValueError: cannot convert float NaN to integer