talmolab / sleap

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

(3a -> 3) Debug missing `PredictedInstance`s (not displaying in GUI) #1757

Closed roomrys closed 5 months ago

roomrys commented 5 months ago

Description

TriangulateSession calls frame_group.upsert_points which should create PredictedInstances for any Camcorders that do not already have an assigned Instance (or PredictedIntance). However, after triangulating, the PredictedInstances were not being displayed in the GUI - even though the containing InstanceGroup appeared to have been filled in with PredictedInstances for each "missing" view.

This PR does 3 things:

  1. adds the filler PredictedInstances to the LabeledFrame
  2. replaces PredictedInstances with Instances (when creating an Instance from a PredictedInstance)
  3. replaces Instance with PredictedInstance (when removing an Instance that ha an associated PredictedInstance)

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 5 months ago

Walkthrough

This update enhances the handling of instances within frame groups in the SLEAP project. It introduces refined logic for adding and removing instances, ensuring proper management and linking of these instances in various structures, thus improving the software's robustness and functionality in tracking scenarios.

Changes

Files Change Summary
sleap/gui/commands.py
sleap/io/dataset.py
Added and refined logic for handling instances in FrameGroup, including addition, replacement, and removal of instances.
sleap/io/cameras.py Refined instance handling in FrameGroup to ensure proper linking without an InstanceGroup.

Possibly related issues

πŸ‡πŸŽ‰ Oh hooray, oh joy, let's hop and twirl, For code that's neat as a bunny's whirl. Instances join, and none shall miss, In frame groups' dance, a coder's bliss. 🌟🐾


Recent Review Details **Configuration used: CodeRabbit UI** **Review profile: CHILL**
Commits Files that changed from the base of the PR and between 8d3e232352d0665db2fd5eb65e3d55d83dbc139a and 0b3adbf4a7b61ef9ea38ca6b30c18aaecbe02508.
Files selected for processing (3) * sleap/gui/commands.py (1 hunks) * sleap/io/cameras.py (3 hunks) * sleap/io/dataset.py (2 hunks)
Additional Context Used
Ruff (34)
sleap/gui/commands.py (11)
38-38: `itertools.permutations` imported but unused --- 38-38: `itertools.product` imported but unused --- 40-40: `typing.cast` imported but unused --- 57-57: `sleap.io.cameras.Camcorder` imported but unused --- 196-196: Undefined name `MainWindow` --- 834-834: Local variable `file_dir` is assigned to but never used --- 1708-1708: Do not use bare `except` --- 1729-1729: Do not use bare `except` --- 2466-2466: f-string without any placeholders --- 2798-2798: f-string without any placeholders --- 3161-3161: Do not use bare `except`
sleap/io/cameras.py (7)
79-79: f-string without any placeholders --- 80-80: f-string without any placeholders --- 81-81: f-string without any placeholders --- 448-448: Undefined name `Skeleton` --- 601-601: Undefined name `Skeleton` --- 829-829: Do not use bare `except` --- 1003-1003: Undefined name `Labels`
sleap/io/dataset.py (16)
55-55: Redefinition of unused `Callable` from line 45 --- 61-61: `h5py` imported but unused --- 69-69: Do not use bare `except` --- 70-70: `typing._ForwardRef` imported but unused --- 365-365: Do not assign a `lambda` expression, use a `def` --- 367-370: Do not assign a `lambda` expression, use a `def` --- 372-375: Do not assign a `lambda` expression, use a `def` --- 934-934: Do not compare types, use `isinstance()` --- 1484-1484: Do not compare types, use `isinstance()` --- 2389-2389: Undefined name `glob` --- 2484-2484: Avoid equality comparisons to `False`; use `if not ret:` for false checks --- 2572-2572: Avoid equality comparisons to `False`; use `if not ret:` for false checks --- 2587-2587: Undefined name `sleap` --- 2677-2677: Do not compare types, use `isinstance()` --- 2680-2680: Local variable `e` is assigned to but never used --- 2682-2682: f-string without any placeholders
Additional comments not posted (2)
sleap/io/cameras.py (1)
Line range hint `601-601`: The name `Skeleton` is undefined in this scope, which will cause a runtime error.
sleap/gui/commands.py (1)
`2931-2950`: Ensure that the new instance is correctly added to the `InstanceGroup`. Please verify that the `InstanceGroup` and `FrameGroup` are correctly updated when a new instance is added. This is crucial for maintaining data integrity and ensuring that the GUI reflects the current state of the model.
--- Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
Share - [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai) - [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai) - [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai) - [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code)
Tips ### Chat There are 3 ways to chat with [CodeRabbit](https://coderabbit.ai): - Review comments: Directly reply to a review comment made by CodeRabbit. Example: - `I pushed a fix in commit .` - `Generate unit testing code for this file.` - `Open a follow-up GitHub issue for this discussion.` - Files and specific lines of code (under the "Files changed" tab): Tag `@coderabbitai` in a new review comment at the desired location with your query. Examples: - `@coderabbitai generate unit testing code for this file.` - `@coderabbitai modularize this function.` - PR comments: Tag `@coderabbitai` in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples: - `@coderabbitai generate interesting stats about this repository and render them as a table.` - `@coderabbitai show all the console.log statements in this repository.` - `@coderabbitai read src/utils.ts and generate unit testing code.` - `@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.` Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. ### 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. Additionally, you can add `@coderabbitai ignore` anywhere in the PR description to prevent this PR from being reviewed. ### CodeRabbit Configration File (`.coderabbit.yaml`) - You can programmatically configure CodeRabbit by adding a `.coderabbit.yaml` file to the root of your repository. - Please see the [configuration documentation](https://docs.coderabbit.ai/guides/configure-coderabbit) for more information. - 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/schema.v2.json` ### Documentation and Community - Visit our [Documentation](https://coderabbit.ai/docs) for detailed information on how to use CodeRabbit. - Join our [Discord Community](https://discord.com/invite/GsXnASn26c) to get help, request features, and share feedback. - Follow us on [X/Twitter](https://twitter.com/coderabbitai) for updates and announcements.
codecov[bot] commented 5 months ago

Codecov Report

Attention: Patch coverage is 29.03226% with 22 lines in your changes are missing coverage. Please review.

Project coverage is 73.78%. Comparing base (8d3e232) to head (0b3adbf).

Files Patch % Lines
sleap/io/dataset.py 25.00% 12 Missing :warning:
sleap/gui/commands.py 30.76% 9 Missing :warning:
sleap/io/cameras.py 50.00% 1 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## liezl/asc-initial-update-instances-across-views #1757 +/- ## =================================================================================== - Coverage 73.84% 73.78% -0.06% =================================================================================== Files 135 135 Lines 24890 24919 +29 =================================================================================== + Hits 18379 18387 +8 - Misses 6511 6532 +21 ```

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