talmolab / sleap

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

Fix package export #1619

Closed talmo closed 11 months ago

talmo commented 11 months ago

Description

In #1559, we switched up the format to use zero-padded, constant length byte strings for embedded PNG encoded images for .pkg.slp files.

Right now this throws an error when we export from labels that have videos without any labeled frames, as is common when generating splits or when there are only predictions in a given video (but not user labels).

This PR fixes that by checking for zero length videos during export.

Types of changes

Does this address any currently open issues?

[list open issues here]

Outside contributors checklist

Thank you for contributing to SLEAP!

:heart:

Summary by CodeRabbit

coderabbitai[bot] commented 11 months ago

Walkthrough

The update in the codebase involves a modification to the way maximum frame size is calculated in a video processing context. This change specifically addresses the handling of empty frames to ensure the calculation is robust. There were no changes to function signatures or other global elements, indicating a targeted fix without altering the API or system-wide data structures.

Changes

File(s) Summary
sleap/io/video.py Modified the calculation of max_frame_size to better handle empty frames.

🐇🎉 To frames once empty, a fix we bestow, In the code where the video streams flow. No signature changed, no structure dismayed, Just a rabbit's touch to the frames displayed. 🎬🌟


Tips ### Chat with CodeRabbit Bot (`@coderabbitai`) - If you reply to a *review comment* from CodeRabbit, the bot will automatically respond. - To engage with CodeRabbit bot directly around the specific lines of code in the PR, mention @coderabbitai in your review comment - Note: Review comments are made on code diffs or files, not on the PR overview. - Add `@coderabbitai ignore` anywhere in the PR description to prevent this PR from being reviewed. ### CodeRabbit Commands (invoked as PR comments) - `@coderabbitai pause` to pause the reviews on a PR. - `@coderabbitai resume` to resume the paused reviews. - `@coderabbitai review` to trigger a review. This is useful when automatic reviews are disabled for the repository. - `@coderabbitai resolve` resolve all the CodeRabbit review comments. - `@coderabbitai help` to get help. Note: For conversation with the bot, please use the review comments on code diffs or files. ### CodeRabbit Configration File (`.coderabbit.yaml`) - You can programmatically configure CodeRabbit by adding a `.coderabbit.yaml` file to the root of your repository. - The JSON schema for the configuration file is available [here](https://coderabbit.ai/integrations/coderabbit-overrides.v2.json). - If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: `# yaml-language-server: $schema=https://coderabbit.ai/integrations/coderabbit-overrides.v2.json`
codecov[bot] commented 11 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Comparison is base (cb82d36) 73.37% compared to head (de5556f) 73.38%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## develop #1619 +/- ## ======================================== Coverage 73.37% 73.38% ======================================== Files 134 134 Lines 24024 24024 ======================================== + Hits 17628 17630 +2 + Misses 6396 6394 -2 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.