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
301 stars 145 forks source link

Attribute error while trying to calculate video parameters in SimBA #132

Open Marcelobot opened 3 years ago

Marcelobot commented 3 years ago

Hello :)

After one complete errorfree analysis with simBA last week i tried to create a new project to repeat exactly the same with other videos but then, after import of videos (MP4) and tracking data (csv) an error occured while video parameter setting:

image

The Error occures after I click on "video" to calculate the distance. Its confusing, because in my old project its still working..

Would be awesome if you may have some tipps or ideas! Im just a medical student with no real python knowledge but alot of pressure ^^

Best

sgoldenlab commented 3 years ago

Hello @Marcelobot!

When you click on Video1, SimBA tries to open the first frame of animal_11_200806cropped_rotated.mp4, and SimBA assumes animal_11_200806cropped_rotated.mp4 is located in the project_folder/videos directory of your new project.

If SimBA can't find animal_11_200806cropped_rotated.mp4 in the project_folder/videos directory, this error could happen. The NoneType error comes from SimBA trying to extract the shape/resolution of the first frame, but there is no resolution because there is no video.

Could you double check that your new project contains a file called animal_11_200806cropped_rotated.mp4 in the project_folder/videos directory?

Cheers!

Marcelobot commented 3 years ago

Hello and thank you for your quick answer!

Sadly thats not the point, the "project_folder/videos" directory contains the correct "animal_11_200806cropped_rotated.mp4" file.

But whats interesting is, that after the occuration of atribute error another file will be created in the same directory: image

As I wrote, last week it worked completely.. but nothing changed since then.

Could it be a problem with any packages missing within python?

Cheers

Marcelobot commented 3 years ago

*Maybe its another issue but, Ive tried out to create another project including video data, that worked out last time this happened:

image

As you can see, there are even parts of the gui disappeared..

The relating error: "TypeError: init() missing 1 required positional argument: 'value'"

sgoldenlab commented 3 years ago

Hi @Marcelobot!

Let’s do the second error first:

The second error msg you are seeing is unrelated to the first. I recently replied to someone on Gitter who saw the same error - https://gitter.im/SimBA-Resource/community. I will just post my prior reply here (also, if you update to the latest version of SimBA pip install simba-uw-tf-dev --upgrade, you should get a more informative error msg when this happens)

This error occurs as SimBA is trying to populate the drop-down menus with your classifier names. 

SimBA looks in your project_config.ini file for the classifier names, it can’t find any names, and it fails as it does not know what to do with the dropdown.

When you created your SimBA project, did you name your behaviors in this entry box?

Untitled (1)

sgoldenlab commented 3 years ago

Back to the first NoneType error:

The 0.bmp file is a temporary image file of the first frame of the video animal_11_200806cropped_rotated.mp4 that SimBA is trying to open. SimBA saves this bmp file temporarily, lets you draw your line, and then SimBA deletes it.

I see that it is only 2kb big, which makes me suspicious that there is something odd with the first frame of animal_11_200806cropped_rotated.mp4. Can you open this bmp file?

Also can you just confirm that you can't open this video in your prior SimBA project either? That way we can confirm that it is something odd with the video and not the SimBA project.

If we confirm it is the video and not the SimBA project I can insert a fix in SimBA to catch this (if there is something odd with the first frame of the video, then try to grab another frame).

Marcelobot commented 3 years ago

Issue 2:

Hi @Marcelobot!

Let’s do the second error first:

The second error msg you are seeing is unrelated to the first. I recently replied to someone on Gitter who saw the same error - https://gitter.im/SimBA-Resource/community. I will just post my prior reply here (also, if you update to the latest version of SimBA pip install simba-uw-tf-dev --upgrade, you should get a more informative error msg when this happens)

This error occurs as SimBA is trying to populate the drop-down menus with your classifier names. 

SimBA looks in your project_config.ini file for the classifier names, it can’t find any names, and it fails as it does not know what to do with the dropdown.

When you created your SimBA project, did you name your behaviors in this entry box?

Untitled (1)

Issue 2:

Ive applied, what you`ve recommented (created a new project and within named the behavior classifier in the beginning as shown on your screenshot). Then the mask wasnt disappeared at first, but then there was none of 2 imported videos listed: image

(the videos are stored correctly in the project/videos direction)

Marcelobot commented 3 years ago

Issue 1:

Back to the first NoneType error:

The 0.bmp file is a temporary image file of the first frame of the video animal_11_200806cropped_rotated.mp4 that SimBA is trying to open. SimBA saves this bmp file temporarily, lets you draw your line, and then SimBA deletes it.

I see that it is only 2kb big, which makes me suspicious that there is something odd with the first frame of animal_11_200806cropped_rotated.mp4. Can you open this bmp file?

Also can you just confirm that you can't open this video in your prior SimBA project either? That way we can confirm that it is something odd with the video and not the SimBA project.

If we confirm it is the video and not the SimBA project I can insert a fix in SimBA to catch this (if there is something odd with the first frame of the video, then try to grab another frame).

I could not open the bmp-file,recieved the message, that there is no information inside.

I tried out as following:

So it seems like it could be related to the video file. The only difference is the quality: The old ones have 796 x 606, while the new one has 760 x 604. Is there something to consider with the video quality?

And in general: Is it possible to just connect quickly via teamviewer or something to fix that ?

Best

sgoldenlab commented 3 years ago

Yes, you are right I think a call would be the quickest way to solve this - can you email goldenneurolab@gmail.com and we will set something up for today or tomorrow?

Marcelobot commented 3 years ago

Update Issue 1:

I can confirm now, That there was something wrong within the video sequences.

When I trim of the First 5sec it works as usual.

The question is, Why it worked out Last week without trimming..

However now Im expecting that my SimBA Project will run.

Ps. If you still want to talk about Ive sent an email.

Cheers