Skip to content

Convert predictions to cliplabels.json using movement#45

Merged
sfmig merged 30 commits into
mainfrom
predictions-conversion
May 14, 2026
Merged

Convert predictions to cliplabels.json using movement#45
sfmig merged 30 commits into
mainfrom
predictions-conversion

Conversation

@sfmig
Copy link
Copy Markdown
Member

@sfmig sfmig commented Apr 1, 2026

Description

What is this PR

  • Bug fix
  • Addition of a new feature
  • Other

Why is this PR needed?
To convert prediction files supported by movement to cliplabels.json files, that we can clip later when extracting video clips.

What does this PR do?
It adds a predictions_to_poseinterface function that reads prediction files as movement datasets and exports the trajectories as a cliplabels.json file, defined for the full range of frames in the prediction file.

References

\

How has this PR been tested?

Tests pass locally and in CI.

Is this a breaking change?

No.

Does this PR require an update to the documentation?

No.

Checklist:

  • The code has been tested locally
  • Tests have been added to cover all new functionality
  • The documentation has been updated to reflect any changes
  • The code has been formatted with pre-commit

@sfmig sfmig marked this pull request as ready for review April 1, 2026 17:39
@sfmig sfmig requested a review from lochhh April 1, 2026 17:43
Copy link
Copy Markdown
Member

@lochhh lochhh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @sfmig , I think the decision to use movement for loading predictions and sleap-io for loading annotations makes a lot of sense! Most suggestions are trivial, but the main comments are related to the lack of error-handling in predictions_to_poseinterface and tests that exercise the function's various possible behaviours.

Comment thread poseinterface/io.py Outdated
Comment thread poseinterface/io.py Outdated
Comment thread poseinterface/io.py Outdated
Comment thread poseinterface/io.py Outdated
Comment thread poseinterface/io.py
Comment thread poseinterface/io.py Outdated
Comment thread tests/test_unit/test_io.py Outdated
Comment thread poseinterface/io.py
Comment thread tests/test_unit/test_io.py Outdated
Comment thread tests/test_unit/test_io.py Outdated
@lochhh lochhh linked an issue Apr 10, 2026 that may be closed by this pull request
@niksirbi
Copy link
Copy Markdown
Member

FYI I've now merged neuroinformatics-unit/movement#920 into movement, which adds a public infer_source_software function, and a source_software='auto' option to load_dataset.

Once we release, this PR can be rebased to directly use movement for the 'guessing'.

@niksirbi
Copy link
Copy Markdown
Member

@sfmig when you get the chance to get back to this, you may find it useful to cherry-pick the following commits from PR #49:

  • c104ec2 (#49) (simplify predictions_to_poseinterface using movement>=0.16 auto source inference)
  • e9aa17e (#49) (Rename cliplabels to videolabels in predictions_to_poseinterface)

niksirbi and others added 7 commits May 13, 2026 12:55
predictions_to_poseinterface produces labels for a full video, not a
clip. Per the spec, this intermediate file should use the _videolabels
suffix. Rename _convert_movement_ds_to_cliplabels accordingly and
update the output filename and all references in tests.
Co-authored-by: Chang Huan Lo <changhuanlo@yahoo.com>
@sfmig sfmig force-pushed the predictions-conversion branch from 6baa5b3 to 04b4134 Compare May 13, 2026 12:36
Comment thread tests/test_unit/test_io.py Outdated
@sfmig
Copy link
Copy Markdown
Member Author

sfmig commented May 13, 2026

Thanks @lochhh and apologies for the delay. I think all comments are addressed, will re-request now.

@sfmig sfmig requested a review from lochhh May 13, 2026 19:34
Comment thread tests/test_unit/test_io.py Outdated
Comment thread pyproject.toml Outdated
Copy link
Copy Markdown
Member

@lochhh lochhh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks again @sfmig for addressing all comments! Pre-approving as there are only two minor things: duplicate movement dependency in pyproject.toml, suggestion to remove assert function calls (wiring will be tested in integration tests).

@sfmig sfmig merged commit 2e72f28 into main May 14, 2026
24 checks passed
@sfmig sfmig deleted the predictions-conversion branch May 14, 2026 10:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement a predictions_to_coco function

3 participants