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
286 stars 139 forks source link

Issue importing APT tracking data #160

Open holfordt opened 2 years ago

holfordt commented 2 years ago

Hello, I am trying to use simBA with videos that have been previously tracking using APT, however when I attempt to load the TRK files, I get an error about the dimensions being out of bounds. Have you seen anything like this before, or know what could be going on?

I am running the freshest install (I think 0.89) on a windows machine.

Thanks, Tim Simba Error

sronilsson commented 2 years ago

Hello @holfordt ! I've only seen a few trk files, and I am thinking it is possible that your TRK files are organized slightly differently (possibly because of a different apt versions?) and that is what is causing the error. Could you share a trk file that SimBA is having problems with and I can check if what is going on and insert a fix if needed?

holfordt commented 2 years ago

Sounds great! Here are a couple from different videos..

To SimBA.zip

sronilsson commented 2 years ago

Cheers! The data from APT I've seen and read about is in the numpoints x numdimensions x numframes x numtargets format, meaning if you track three animals, with 8 body-parts each, with a single camera, for 12000 frames you have an array that is 8x2x12000x3 - https://kristinbranson.github.io/APT/appendices.html#Trk%20file%20contents

SimBA however sees your data shape as 14556x2x11. If I had to guess it is 14556 frames, one camera, 11 body-parts, and a single animal. I've actually seen this issue before (the different order, beginning with the frames dimension) and SimBA already has a fix to re-organize the data into the appropriate format. What we don't have a fix for, however, is the last dimension - your data is NxNxN but the APT data I've seen is NxNxNxN - thats why you get the error of the missing axis.

.. anyhow I will insert the fix - I just want to confirm that it is a single animal you are tracking so I don't head down the wrong path?

holfordt commented 2 years ago

Oh interesting. That makes sense, and you are correct about the structure of our data. 11 body parts, 2 dimensions, 14556 frames and one animal. I noticed when I selected the APT style that is said multi animal tracking, but I didnt think it would work if I tried to load it in a different format.

sronilsson commented 2 years ago

Hello @holfordt - can you try an update SimBA with pip install simba-uw-tf-dev --upgrade, it is version 0.89.1, and try again to import the apt files?

holfordt commented 2 years ago

Hi, yes it looks like it has imported them now. Thank you! I will try to go through the rest of the process and let you know if I have any other issues. Thanks again.