Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@agosztolai
Copy link

@agosztolai agosztolai commented May 5, 2025

This PR implements a method to convert a Sleap project to DeepLabCut project, as suggested in #2734.

@maximpavliv maximpavliv changed the title Update conversioncode.py Sleap to Deeplabcut conversion method May 7, 2025
@maximpavliv maximpavliv added the enhancement New feature or request label May 7, 2025
@maximpavliv maximpavliv self-requested a review May 7, 2025 09:49
@maximpavliv
Copy link
Collaborator

Hey @agosztolai

I refactored a bit your method, hope it's okay for you 😀.

I am testing it now with a simple Sleap project I created, but it doesn't work for now on my side: it basically never enters inside this condition, and, having manually checked, I don't see anything like this in my Sleap file. My Sleap file contains the following keys:
<KeysViewHDF5 ['frames', 'instances', 'metadata', 'points', 'pred_points', 'suggestions_json', 'tracks_json', 'videos_json']>.
The dataset under 'videos_json' does store the path to the video I used when creating my Sleap project.
Therefore video_names is empty and nothing is done inside this whole for loop neither.

Is there an issue with your code or did I do something wrong when creating my Sleap project? I am new to Sleap so maybe the mistake is on my side.
Or maybe we have different Sleap versions, which store data differently? I currently have SLEAP v1.4.1a2

@maximpavliv maximpavliv added the more-data-requested-by-us We would like to get more data to answer label May 12, 2025
@Bzver
Copy link

Bzver commented May 21, 2025

Hello @maximpavliv ,

I can confirm that the code works on SLEAP v1.4.1a2, but it needs the .pkg.slp file from 'Predict - Export Labels Package... - Labelled frames' instead of the .slp project file.
scr

By the way, I have a couple of suggestions:

  1. The line 527 and 528 should be instance_dataset[i] instead of instance_dataset[i+1], the latter caused an out of range error on my end.
  2. I recommend adding the line
    "Task": f"{scorer}-{sleap_file.split('labels.')[1].rsplit('.pkg.slp', 1)[0]}",
    (Assuming the sleap_file follows the format of /path/to/labels.xxx.pkg.slp)
    below config = { at line 421, without which will throw a KeyError: ‘Task' when attempting to load from the generated config.yaml.

@maximpavliv maximpavliv removed the more-data-requested-by-us We would like to get more data to answer label May 21, 2025
@Bzver
Copy link

Bzver commented May 22, 2025

A further issue: during the 'Analyze Videos' step in DLC, the project froze due to the generated config.yaml missing the multianimalproject:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants