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
272 stars 137 forks source link

Outlier Correction - Location #336

Closed DanaeNikol closed 4 months ago

DanaeNikol commented 4 months ago

Hi there! When I run the outlier correction, the correction for the movement works fine and is completed but once the first video starts being processed for the location outlier correction, it does not go through and it seems as if Simba(GUI) has crashed. From the final output, there is only one csv file for the movement correction.

What could be wrong?

Thank you!

Desktop (please complete the following information):

sronilsson commented 4 months ago

Hey @DanaeNikol ! Did you see any traceback error messages in the linux terminal after SimBA crashed? Would be helpful for me to try to replicate the issue and see where it went wrong.

DanaeNikol commented 4 months ago

Thanks for your help! I noticed that in the end it was processing everything but on a super slow pace (only visible after an hour that sth was actually happening). Thus there were no traceback error messages.

However, for some videos it would say processing.. but right after 'skipping outlier correction' for another video. Would this be normal?

sronilsson commented 4 months ago

Hey @DanaeNikol ! Not entirely sure what's going on but I can make some guesses... :)

If outlier correction is super slow: is it possible that the outlier criteria is very stringent, and the data is large? Say that using your criteria means that most or all body-part movements are classified as outliers. That would mean all body-parts have to be corrected, which sould take significant time if the data is big? You can try increasing the criteria to see if that fixes it.

For the ... right after 'skipping outlier correction' for another video, could it be that you clicked to run outlier correction, and as it was so slow, you clicked Skip outlier correction while the outlier correction was still running? This would mean that the two processes (running outlier correction, and skipping outlier correction) would run simultaneously on two threads on your computer and you would get a messages from both these processes?

DanaeNikol commented 4 months ago

Hi @sronilsson!

I think both your guesses are correct. Regarding the outlier correction, as criteria i used what was recommended, meaning 1.5 for the movement and 1.7 for the location. It is indeed true that (I think) all of my body part movements seem to have been corrected for a very high number of frames (each video should have in total approx 8900 frames). Here is a brief screenshot:

Screenshot at 2024-02-24 15-23-55

If I get such results, then I guess it would make a lot of sense to either change my criterion or the body parts I am using to calculate the reference value?

The quality of the detections, at least as judged by the dlc created videos seemed very good to get such intense outlier correction. As bodyparts for the outlier correction I used the defaults provided by Simba as suggested, but these were the two ears, thus the gross correction could be partially explained by that?

I am sorry for the naivity of my questions, I am very new in this field.

Your second guess is very correct, I reran everything and it all seemed normal!

Thanks a lot!!

sronilsson commented 4 months ago

Hi @DanaeNikol !

Yes, the outlier correction code looks at the aggregate mean or median distances and movement between body-parts in the video, and takes that aggregate value and multiplies it by your criterion value (e.g., 1.5) to produce a threshold value. It might be, that that threshold value is too low in your case. That threshold value, from the documentation, worked well for me in my tutorial example, but it will not be universally true and is dictated by your animal body-parts and quality of tracking. The model I used for the tutorial was trained with I think 3-4k annotated images, so it was very exact and maybe, looking back, not the best example to use in a tutorial... 😬

DanaeNikol commented 4 months ago

Thank you @sronilsson!