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
289 stars 141 forks source link

Analysing wrong bodypart #295

Open FarahnazYF opened 11 months ago

FarahnazYF commented 11 months ago

Describe the bug

I have a 10-minute video with one animal, and I labeled 4 bodyparts using DeepLabCut (in order: nose, left ear, right ear, tail base). When I want to analyse the data, no matter which body part I choose, the results is always for the left ear, which is the first bodypart in CHOOSE ANIMAL BODI-PARTS. I reset the defined pose config and defined the bodyparts again, but still when I run the analyse ROI data instead of nose, it track the left ear. I updated my Simba, but still I have the same problem. I'm not sure what I should do to solve this problem and I appreciate any advice you may have.

Expected behavior I want to use Simba for novel object recognition test and record the time for the nose when it is within the ROI.

Screenshots 2023-10-15_133010

2023-10-15_133423 2023-10-15_133256

Desktop (please complete the following information):

Additional context Everything runs without any problems or errors.

sronilsson commented 11 months ago

Hi @FarahnazYF - thanks for reporting! Let me see if I can replicate this and see what is going on...

sronilsson commented 11 months ago

Hi @FarahnazYF - if I understand correctly: regardless which body-part you select in the body-part drop-down, you get the ROI statistics for the Left_ear body-part?

Unfortunately I couldn't replicate this issue - I get different results depending on which body-parts I choose using the pop-up in your screengrab. However, one thing that made it tricker to evaluate this issue, was that many of output files (in your lower screengrab) does not contain a column saying which body-part was used to compute the statistics. I have now included it so you should see this:

image

image

If you update simba with pip install simba-uw-tf-dev --upgrade (version 1.74.8) and run it, do you see the same body-part in the BODY-PART column and statistic in the output files, regardless what you choose in the body-part dropdown?

FarahnazYF commented 11 months ago

Dear @sronilsson,

Thank you so much for checking it. I think updating my Simba helped a lot, because now I can choose different boyparts and I got their relative results.

2023-10-15_194644

However, if I want the data for the nose, still I have to choose left ear, and I guess this is because when I was labeling the bodyparts in the DeepLabCut, first I labeled the nose, but in Simba labeling order starts from the left ear. I hope my explanation make sense. Maybe if I label my frames again with the same order as Simba uses, it helps.

2023-10-15_193155

2023-10-15_193649

This picture is for a video when I chose left ear, but you can see that it tracked nose. 2023-10-15_195843

Thanks again for you help.

sronilsson commented 11 months ago

Ah thanks @FarahnazYF - that info helped a lot.

You are correct, when you are using the in-built pose-configuration from your screengab, SimBA expects the body-part data from DeepLabCut to be in a specific order.

However, you don't have to label frames in DeepLabCut again.

When you create a SimBA project, a file gets stored in your project at location /project_folder/logs/measures/pose_configs/bp_names/project_bp_names.csv and if you open it, it will look like this ans stores the names of your body-parts and their order:

image

You can try and change this order to the actual order you have your body-parts in, e.g.,:

image

Then save that file, and finally import your data to your SimBA project.

Now your SimBA project should have the right body-part names associated with the right columns and data.

FarahnazYF commented 11 months ago

Dear @sronilsson,

Thank you so much for your precious help. I just wanted to let you know that I could run the analysis without any problem.

Best,

sronilsson commented 11 months ago

Thanks for letting me know!