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

Mismatch in ROI data analysis. #202

Closed DorianBattivelli closed 1 year ago

DorianBattivelli commented 1 year ago

Hello,

First of all thank you again for providing these amazing data analyzes tools.

I would like to report several mistakes I observed while analysis ROI data. I'm working on Windows 10, and I use 0.92.2 version of Simba (installed with simba-uw-tf-dev command 2 months ago)

I used el.h5 files from DLC-multi animal project, including 2 mice to track simultaneously.

Among the errors I noticed:

How can I fix these issues?

Thank you, Best, Dorian

sronilsson commented 1 year ago

Hi @DorianBattivelli! Many thanks for reporting! First, can up update to the latest version of simba-uw-tf-dev (should be version 0.93.8) with pip install simba-uw-tf-dev --upgrade, and see if you still see the same issues?

DorianBattivelli commented 1 year ago

Thank you for the help. I managed to update the version. Though, the 3 mentioned mistakes still appear if I launch the Analyze ROI data process. I precise that I did not recreate a project from scratch and only tried to run the analysis from my existing project.

Best,

sronilsson commented 1 year ago

Thanks for testing - when you import the data from multi-animal DLC, there is an interface to specify which animal is which by clicking the animals in the image - https://github.com/sgoldenlab/simba/blob/master/docs/Multi_animal_pose.md#step-5-assigning-tracks-the-correct-identities. Is it possible that the mouse click for animal 1 was closer to a body-part of animal 2, and vice versa?

DorianBattivelli commented 1 year ago

Yes, I see the step you're mentioning. I thaught about this but I'm almost sure that I did not do a mistake at that stage. Also, when I run the same command on my previous project, I observed the same errors.

Best,

sronilsson commented 1 year ago

Thanks @DorianBattivelli - let me see if I can recreate this - can you send me an example of the ROI_time_data file to better understand what is going on? You can zip it and drop it here I think.

Also, does it happen on all videos, or is it a single one?

DorianBattivelli commented 1 year ago

So, I did a new project from scratch to be sure about the ID attributions. And again, even with this last version, I confirm that the IDs either in the ROI csv files, and in the path plots videos are inverted.

Here the file: ROI_time_data_20220727124702.csv

Theoretically MS = mouse 1 and US = mouse 2. I know for sure that US spent almost no time in Down-comp, and almost all the time in Up-comp, while MS spent a bit more than half of the time in Down-comp. The CSV files says exactly the opposite.

sronilsson commented 1 year ago

Thanks @DorianBattivelli for digging! I appreciate it. I can't immediately replicate it in my troubleshooting projects, but need to figure this one out. Can you help me with two more things?

If you visualize the ROI calculations using the Visualize ROI tracking menu, does it also look inverted? With MS having the label as US and vice versa?

Can you share your SimBA project with me? It is enough with the single video inside it. But I also need the DLC 'el.h5` to import it, be be able to follow your steps.

DorianBattivelli commented 1 year ago

Running Visualize ROI tracking returns the following error: ROI_Tracking

I will upload the project on Drive and share it with you asap. Can I remove the frame folder form the project? It takes 12gb..

Best,

sronilsson commented 1 year ago

Yes! No need for the frames at all.

sronilsson commented 1 year ago

Thanks @DorianBattivelli!

DorianBattivelli commented 1 year ago

To which email adress can I share the folder?

sronilsson commented 1 year ago

Thanks! I will test it asap, and figure out why you see the visualization error (as its not showing for me either). Can you share it with sronilsson@gmail.com ?

DorianBattivelli commented 1 year ago

Done, thanks!

sronilsson commented 1 year ago

Great, is the _el.h5 in there too? At quick browse I can't see it

DorianBattivelli commented 1 year ago

No my mistake, I added them now and updated the sharing,

Thanks!

sronilsson commented 1 year ago

Got it!

On Thu, Jul 28, 2022 at 6:37 AM DorianBattivelli @.***> wrote:

No my mistake, I added them now and updated the sharing,

Thanks!

— Reply to this email directly, view it on GitHub https://github.com/sgoldenlab/simba/issues/202#issuecomment-1197970538, or unsubscribe https://github.com/notifications/unsubscribe-auth/AIJGTBBEM44W2P5ZTSRTFP3VWJPG3ANCNFSM54VRCKBQ . You are receiving this because you commented.Message ID: @.***>

sronilsson commented 1 year ago

@DorianBattivelli, if you check the video at https://drive.google.com/file/d/1HvbWTV8e1SCb9XIqFnFyb00QsTx8_4Xa/view?usp=sharing, are animal IDs inverted? (watch out it is large..).

DorianBattivelli commented 1 year ago

Yes, they are inverted

sronilsson commented 1 year ago

Hi @DorianBattivelli - I ended up completely rewriting the DLC import class.. sorry for delay. Could you try and update simba to version 0.94.2, and import the dlc data again, and see how it goes?

DorianBattivelli commented 1 year ago

@sronilsson thank you very much, it solved the issue. Now the ID are right ! Thank you again.

Also, I wanted to ask you how to improve the quality of the distance measurment? I suspect that the variation of the exact location of the center body part label from one frame to the other is considered as displacement / movement, so that even when the animal is immobile, this artificial displacement of the body label is considered as locomotion. I tried to change the movement criterion parameter but it does not look to change the distance measurment. Is there something I can do?

Thank you again! Best,

sronilsson commented 1 year ago

Hi @DorianBattivelli - one possible way is to use smoothing when you import your data. There are two options (Gaussian, Savitzky-Golay). After you've imported your data, you can visualize it using this tool from the Tools dropdown to check if it looks less jumpy. There is a video example here of the expected results: https://www.youtube.com/watch?v=d9-Bi4_HyfQ

DorianBattivelli commented 1 year ago

Amazing, thank you very much,

Best!