sgoldenlab / simba

SimBA (Simple Behavioral Analysis), a pipeline and GUI for developing supervised behavioral classifiers
https://simba-uw-tf-dev.readthedocs.io/
GNU General Public License v3.0
279 stars 138 forks source link

Overflow error in extracting features step in pipeline #195

Closed fon215 closed 2 years ago

fon215 commented 2 years ago

Describe the bug I am working through the pipeline and successfully did outlier correction and started the Extract Features step but encountered the error here and the SimBA command window was stuck on extracting features from video 1. Could someone help me understand what is happening here.

Exception in thread Thread-5: Traceback (most recent call last): File "c:\tools\anaconda3\envs\simbaenv\lib\threading.py", line 916, in _bootstrap_inner self.run() File "c:\tools\anaconda3\envs\simbaenv\lib\threading.py", line 864, in run self._target(*self._args, **self._kwargs) File "c:\tools\anaconda3\envs\simbaenv\lib\site-packages\simba\SimBA.py", line 6172, in extractfeatures feature_extractor.extract_features() File "c:\tools\anaconda3\envs\simbaenv\lib\site-packages\simba\features_scripts\extract_features_user_defined_new.py", line 104, in extract_features roll_windows.append(int(fps / self.roll_windows_values[i])) OverflowError: cannot convert float infinity to integer

Desktop (Lenovo P340 Workstation (ThinkStation) - Type 30DH (Tower Form Factor)):

-OS build: 19043.1706 (Processor: Intel(R) Core(TM) i9-10900K CPU @ 3.70GHz 3.70 GHz) -Python Version 3.10.4 -Are you using anaconda? - Yes

Additional context

I am working through a remote desktop while using this software.

sronilsson commented 2 years ago

Hi @fon215! If you open up the project_folder/logs/video_info.csv file, how does it look like, do you have a fps value for all of your videos, something similar like the image below?

image

Also, what is the minimum fps you see in the fps column?

fon215 commented 2 years ago

The screenshots below show what that video_info.csv file looks like. The first screenshot shows the end of the file, where my last video does not have values for the first three columns. I am not sure if this has something to do with it, but the folder I imported the videos from contained the videos before I performed the DeepLabCut training, so some are labeled while the others are not. The second screenshot shows the top of the video_info.csv file where you can see what I am talking about. I tried to delete the ones without labels, but then ended up going back to import them back in before continuing to the video parameters, outlier correction, and now the feature extraction steps. However, the total labeled number of videos is 29, which it said it was extracting features from video 1/29 when it got stuck and this error appeared. I am not sure if something with that needs changed.

Screen Shot 2022-07-09 at 11 58 33 AM Screen Shot 2022-07-09 at 11 58 48 AM

The lowest number of fps is 25.

sronilsson commented 2 years ago

Hi @fon215 ! The error you saw, related to infinity, is something you'd see if you try to divide a value by 0. SimBA tries to calculate how many frames exist in different time windows and therefore need the fps of each of your videos.

One of these videos appear to be entered as having zero frames per second, see screenshot below, which is likely causing the issue. I'd also recommend only importing videos into your project that you want to analyze, and skip the videos with the _labelled suffix.

image
fon215 commented 2 years ago

Okay, thank you! So you suggest that I do not include videos that have the skeleton and labels for body parts produced by DeepLabCut, and just use the original videos? I am assuming that this means that the CSV files produced by DLC are the tracking data needed and contain the information that I see in the videos with thelabeledsuffix. Let me know if I am not understanding this correctly!

sronilsson commented 2 years ago

Yes SimBA has no use for the visualizations generated through DLC, SimBA only wants the original videos representing the tracking data you want to analyze.

fon215 commented 2 years ago

Okay, thank you!