talmolab / sleap

A deep learning framework for multi-animal pose tracking.
https://sleap.ai
Other
436 stars 97 forks source link

Export as analysis CSV or HDF5 requires tracks #1853

Open mwinding opened 4 months ago

mwinding commented 4 months ago

Bug description

Exporting as an analysis CSV or HDF5 only works if you have predictions and have run tracking. If you just want predictions without tracking on SLEAP, the CSV or HDF5 will only export a single instance, even if you have dozens of predicted instances. This occurs using the export functions on the GUI, as well as using sleap-convert on commandline.

As an example, I predicted the first few frames of a video via commandline with or without tracking, and then exported as CSV.

Expected behaviour

In the video provided, there should be roughly 30 instances per frame. If I perform tracking after prediction, I see roughly 30 instances per frame in the analysis CSV as expected.

Screenshot 2024-07-05 at 11 00 54

tracks.analysis.csv

Actual behaviour

But if I only run predictions and then export to an analysis CSV, I see only a single instance per frame. I suspect the issue is that the tracks column is blank and this is assumed to be populated in the export scripts

Screenshot 2024-07-05 at 11 02 09

no-tracks.analysis.csv

Your personal set up

I have tried this on macOS using the export option in the GUI of sleap-label and on a linux-based HPC using sleap-convert on commandline. I suspect the specific details of the OS isn't important here. I can provide more details if you cannot replicate the bug.

I have tried this both for .h5 and .CSV analysis export. Same issue.

mwinding commented 4 months ago

Software versions: SLEAP: 1.3.3 TensorFlow: 2.9.2 Numpy: 1.22.4 Python: 3.9.15

talmo commented 4 months ago

Hi @mwinding,

Apologies for the long delay!!

We do assume that there are tracks for exporting, but it's very possible to convert untracked data to whatever format you're looking for using the sleap-io API for convenience.

Here's a notebook that should do the trick.

Let us know if that works for you!

Cheers,

Talmo