YttriLab / B-SOID

Behavioral segmentation of open field in DeepLabCut, or B-SOID ("B-side"), is a pipeline that pairs unsupervised pattern recognition with supervised classification to achieve fast predictions of behaviors that are not predefined by users.
GNU General Public License v3.0
190 stars 54 forks source link

win_len is negative for FPS < 11 #32

Closed djanders19 closed 3 years ago

djanders19 commented 3 years ago

OK, closed my last issue but found an actual issue: in train.py win_len is calculated using this formula: win_len = np.int(np.round(0.05 / (1 / fps)) * 2 - 1)

The issue here is that if fps < 11 this will return a win_len of -1. This value later gets passed to the boxcar_center function, which passes it to a1.rolling in the likelihoodprocessing.py file. This is a Pandas function that throws an exception when passed negative values. Is this an unintentional bug, or is there a reason to not use this software with low-fps video?

There are also numerous other areas where fps is divided by magic numbers (e.g. train.py line 87) which may cause errors - I'm not sure as I've not reached that point in the code yet - wanted to check if there was a real reason to not use low-framerate video before trying to test all the rounding. Thanks!

runninghsus commented 3 years ago

hi @djanders19

I will make this an option in the update. Thanks for the issue!