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
296 stars 143 forks source link

Issue when importing DLC .H5 file #43

Closed franciscamachado closed 4 years ago

franciscamachado commented 4 years ago

Hello,

I'm attempting to create a new project using multi-animal pose estimation data from DLC. However, I am unable to import the tracking data in .H5 file format from DeepLabCut.

First I generated the Project Config, defined the tracking as multi-animal and imported the raw videos used to train the network on DLC. Yet, when i try to import the tracking data in .H5 file format from DeepLabCut from the DLC output folder "\training-datasets\iteration-0\UnaugmentedDataSet", with the .H5 file, I receive the following message on SimBA: "Importing 0 multi-animal DLC h5 files to teh current project. All multi-animal DLC .h5 tracking files ordered and imported into SimBA project in CSV file format".

How can i solve these problems?

Thank you.

sgoldenlab commented 4 years ago

Hi @franciscamachado - first, the file you have in your \training-datasets\iteration-0\UnaugmentedDataSet folder is likely not the DLC output file we need to import into SimBA. The \training-datasets\iteration-0\UnaugmentedDataSet folder typically does not store pose estimation tracking data (unless you moved a video in there and then analyzed it, which is a little unusual), but rather it stores your annotations which is used to train DLC models. In order words, the file you may be trying to import into SimBA may look a little like this (if opening the .csv version of the file), and contain the coordinates of your own mouse clicks during annotations in DLC (you are likely to have less empty cells than this, but I just want to make the point):

image

What we need to import into SimBA from maDLC it the H5 file generated when analyzing a video in DLC. This file will be located in the same folder as the video file you analyzed. For example, in this screenshot below, I have analyzed a video in maDLC called "Together1.mp4" using the "skeleton" option in DLC:

image

In the SimBA interface you tell which option you used to analyze the file in DLC (skeleton or box). If you used "skeleton" in DLC, then you h5 files will be tagged with a file ending "_sk.h5", as in my example screenshoot above. If you used box, then the files will be tagged with a file ending "_bx.h5". If you tell SimBA you used a skeleton setting, then SimBA is looking for files in your selected folder ending with "_sk.h5". I think that part of the issue you are having is that you are pointing SimBA to a folder that does not contain any "_sk.h5" files. Let me know if this makes sense! Thanks

franciscamachado commented 4 years ago

Thank you for the reply and help. I was using maDLC and I had to go through the refine tracklets stage to get the h5. As you described, after that stage, the h5 does appear on the same folder of the original video.

Related to this issue, when I import the h5 into SIMBA I get an error if I used an .avi video file to create the h5 file, as SIMBA always ends up looking for a .mp4 file. If I convert the video to .mp4 it works fine. How can i solve this problem?

Thank you.

sgoldenlab commented 4 years ago

Hi @franciscamachado - yes I noticed this the other day - it was reported by another user https://github.com/sgoldenlab/simba/issues/46#issuecomment-661153273

Can you update SimBA to the latest version via pip - pip install simba-uw-no-tf==1.2.6 or pip install simba-uw-tf==1.2.6 and let me know if that fixes the issue?