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

SIMBA VALUE ERROR- Issue Importing H5 and slp tracking data #365

Open wallawhitecoat opened 1 month ago

wallawhitecoat commented 1 month ago

Simba Problem SimBA Problem 2

I'm trying to start a new project and import labels from sleap (resident intruder). I tried importing as a .slp file and a H5 file I had. Neither worked and I get this message from SimBA, or the GUI quits. I only imported 1 video, ten mins long, 60fps, and over 36,000 frames. Any help would be appreciated, thank you!

sronilsson commented 1 month ago

Hi @wallawhitecoat thanks for reporting - this error happens as SimBA looks for the body-parts from SLEAP that are most proximal to your button clicks, in order to assign the animals their correct identities across videos.

Looking at the image of the resident and Intruder above, your SLEAP tracking does not appear to contain any data for the frame being shown. If there is no data (and you perform no interpolation), SimBA places the body-parts at coordinates 0,0 - top left of the image:

image

You could try to perform interpolation as you import the data into SimBA to get body-part predictions for all frames. Alternatively is to improve the pose-estimation model so it generates accurate predictions for all frames and no interpolation is needed.

Let me know if that makes sense!

Simon

wallawhitecoat commented 3 weeks ago

Hi Simon, thank you for the response. I was able to export an H5 file with predictions on every frame. Here is what my skeleton looks like in SimBA and in SLEAP. Skeleton settings Project Config SimBA SLEAP Skeleton

Unfortunately, I keep getting this notification from SimBA, what should I do? Thank you! SimBA Problem3

sronilsson commented 3 weeks ago

Hi @wallawhitecoat !

Can you drop the labels.v0012.h5 in this thread and I can take a look what is going on in there? You should be able to zip the file up and drag it into the thread. I am not sure why SimBA thinks there are only 14 body-parts in there.

wallawhitecoat commented 3 weeks ago

Sure, let me know if this file works!

labels.v0012.zip

sronilsson commented 3 weeks ago

Thanks - just a sanity check - the file labels.v0012.h5 is only 93kB, very small, and as it's called "labels", I have to ask:

Does this file contain your hand annotations SLEAP ? Or do the files contain machine generated body-part predictions for all frames in the respective videos? I ask as previously HERE and more specifically HERE someone also tried to use a file with the same filenames as yours and I think it was just hand labels and not machine learning predictions.

wallawhitecoat commented 3 weeks ago

It contains both hand annotations and machine generated body-part predictions for all frames. I went back to sleap and predicted all of the frames on a copy of the video I was using and exported that prediction as an H5 file. The new file is 4,094KB. Now I get a similar problem as before, but instead of saying that the number of body parts is 11 instead of 22. image labels.v0013.zip

This is how I'm saving in SLEAP image

wallawhitecoat commented 3 weeks ago

UPDATE: I was able to download a csv file, but it only shows tracking on one mouse image

The CSV file looks like this when I open it, I notice that there is only one "instance score" for each frame, if that is helpful in determining why only 11 nodes are being recognized. image

sronilsson commented 3 weeks ago

Yeah that seems likely - is the track field all blank? Even if you sort by frame_idx field? That would explain why there are only have the expected body-parts.

In the frame_idx field, are there two instances of every frame number?

wallawhitecoat commented 3 weeks ago

That was it, thank you! I re ran my trained model and included tracks on sleap, so all of my predictions have tracks now.

image image

sronilsson commented 3 weeks ago

Great news, onwards and upwards! :) let me know if anything else comes up