sleap icon indicating copy to clipboard operation
sleap copied to clipboard

Small improvements to tracking

Open getzze opened this issue 1 year ago • 9 comments

Description

Several things were buggy when running tracking-only from GUI or sleap-track from CLI with only tracking:

  • improve the ETA in the GUI progress bar by computing the list of frames before starting the timer.
  • show a progress bar when tracking, like for inference(+tracking)
  • correctly pass default options for tracking to CLI. It seems all tracking options that were not defined were given the None value, which is boolean-False, so it could give the opposite for True-by-default options (there are none so far, fortunately).
  • small bug in GUI video that makes it crash when clicking.
  • switch the default value of save_shifted_instances to True and give back access to setting it from the GUI (removed in #1447, I don't know why)
  • allow running tracking only on defined frames. It always run on the full video now.
  • [EDIT] fix a bug introduced by #1875, where the data_path variable was overwritten.

Types of changes

  • [x] Bugfix
  • [x] New feature
  • [ ] Refactor / Code style update (no logical changes)
  • [ ] Build / CI changes
  • [ ] Documentation Update
  • [ ] Other (explain)

Does this address any currently open issues?

None

Outside contributors checklist

  • [x] Review the guidelines for contributing to this repository
  • [x] Read and sign the CLA and add yourself to the authors list
  • [x] Make sure you are making a pull request against the develop branch (not main). Also you should start your branch off develop
  • [x] Add tests that prove your fix is effective or that your feature works
  • [x] Add necessary documentation (if appropriate)

Thank you for contributing to SLEAP!

:heart:

Summary by CodeRabbit

Summary by CodeRabbit

  • New Features

    • Enhanced tracking capabilities with improved reporting options, allowing for more user control over output.
    • Reintroduced and refined configuration options for saving shifted instances during tracking.
    • Introduced new inference pipeline options, including movenet-lightning, movenet-thunder, and tracking-only.
    • Added a custom progress rate display for better user feedback during tasks.
  • Bug Fixes

    • Improved error handling in mouse event detection to prevent negative values.
    • Adjusted calculations to ensure non-negative counts during tracking.
  • Refactor

    • Integrated tracking logic directly into the Tracker class, removing standalone functions for better encapsulation.
    • Updated the data processing flow for batch predictions to enhance modularity and clarity.
    • Simplified tracking test logic by removing intermediary functions.
  • Tests

    • Updated tracking tests to incorporate image scaling and parameterized testing for improved coverage.
    • Adjusted expected outcomes in tracking integration tests for accuracy.

getzze avatar Aug 02 '24 18:08 getzze

Walkthrough

The recent updates to the Sleap framework enhance tracking and inference capabilities. Key modifications include refined configuration options, improved error handling, and better user experience. Changes optimize performance, introduce new reporting features, and streamline object-oriented design, making the system more maintainable and extendable.

Changes

Files Change Summary
sleap/config/pipeline_form.yaml Removed tracking.max_tracking; added tracking.save_shifted_instances with default false; updated default for tracking.match to greedy.
sleap/gui/learning/dialog.py Adjusted no_result_count calculation to prevent negative values, enhancing reliability.
sleap/gui/widgets/video.py Introduced _down_pos for mouse tracking; improved logic in mouseReleaseEvent to ensure error-free click detection.
sleap/nn/inference.py Replaced report_period with a cached property; added _process_batch, _run_batch_json, and _run_batch_rich methods; improved error handling.
sleap/nn/tracking.py Added verbosity and report_rate attributes; introduced run_step, _run_tracker_json, and _run_tracker_rich methods; improved tracking feedback mechanisms.
sleap/util.py Introduced RateColumn for custom progress rendering; reorganized imports for clarity.
tests/nn/test_tracker_components.py Renamed tracker_by_name to run_tracker_by_name; included img_scale parameter for enhanced testing capabilities.
tests/nn/test_tracking_integration.py Updated assertions in test_simple_tracker; refactored tests to utilize instance methods for tracking.

Possibly related PRs

  • #1986: The changes in the main PR, which focus on modifying tracking parameters in the configuration file, are related to the retrieved PR that introduces a max_tracking feature in the Tracker class, as both involve enhancements to tracking capabilities and parameters in the tracking module.

Suggested labels

Re-tracking Spread, MultiView Stack

Suggested reviewers

  • talmo
  • gitttt-1234

🐰 In a world of code so bright,
Each change brings a new delight!
With tracking swift and errors few,
Our framework hops to something new.
Here’s to progress, let’s all cheer,
For every byte, we hold so dear! 🌟

✨ Finishing Touches
  • [ ] 📝 Generate Docstrings

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • 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 gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @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.
    • @coderabbitai help me debug CodeRabbit configuration file.

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 using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai plan to trigger planning for file edits and PR creation.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration 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 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 for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

coderabbitai[bot] avatar Aug 02 '24 18:08 coderabbitai[bot]

Also fixes a bug introduced by #1875, where the data_path variable was overwritten.

getzze avatar Aug 02 '24 23:08 getzze

Codecov Report

Attention: Patch coverage is 71.42857% with 58 lines in your changes missing coverage. Please review.

Project coverage is 76.29%. Comparing base (7991f14) to head (d2249c8). Report is 109 commits behind head on develop.

Files with missing lines Patch % Lines
sleap/nn/tracking.py 67.77% 29 Missing :warning:
sleap/nn/inference.py 72.91% 26 Missing :warning:
sleap/gui/learning/dialog.py 0.00% 1 Missing :warning:
sleap/gui/widgets/video.py 50.00% 1 Missing :warning:
sleap/util.py 92.85% 1 Missing :warning:

:x: Your patch status has failed because the patch coverage (72.00%) is below the target coverage (100.00%). You can increase the patch coverage or adjust the target coverage.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #1894      +/-   ##
===========================================
+ Coverage    75.43%   76.29%   +0.85%     
===========================================
  Files          134      133       -1     
  Lines        24749    24995     +246     
===========================================
+ Hits         18670    19069     +399     
+ Misses        6079     5926     -153     

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

:rocket: New features to boost your workflow:
  • :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

codecov[bot] avatar Aug 02 '24 23:08 codecov[bot]

It's ready for review!

getzze avatar Sep 04 '24 16:09 getzze

Thanks for the updates @getzze! Just keep us posted on when it's ready for review again.

talmo avatar Sep 12 '24 01:09 talmo

It's ready to review!

getzze avatar Sep 12 '24 21:09 getzze

Hi @getzze ,

I rebased you branch off of our updated develop branch and I noticed there are few errors in the tests because of the new features added. (One of the main addition is having a new parameter img_hw to the Tracker.track() method) Since I don't have access to your branch, could you please resolve the issues so that we could merge this PR to develop?

Thanks,

Divya

gitttt-1234 avatar Sep 27 '24 18:09 gitttt-1234

Hi @gitttt-1234, I just pushed the changes.

Thanks

getzze avatar Sep 30 '24 12:09 getzze

Hi @gitttt-1234, I rebased to develop and tests are passing.

getzze avatar Oct 25 '24 16:10 getzze

@gitttt-1234 thanks for reviewing! I modified the code to address your points (I hope :) ).

getzze avatar Apr 08 '25 10:04 getzze

@gitttt-1234 I made all the corrections, thanks!

getzze avatar Apr 08 '25 20:04 getzze

Thanks @getzze ! Could you also resolve the errors caught in our CI tests?

gitttt-1234 avatar Apr 09 '25 16:04 gitttt-1234

@gitttt-1234 the tests should pass now

getzze avatar Apr 09 '25 21:04 getzze

@gitttt-1234 Tests are passing and PR is rebased

getzze avatar Apr 10 '25 15:04 getzze

@gitttt-1234 Everything good!

getzze avatar Apr 14 '25 13:04 getzze

sorry to bug you @gitttt-1234 but is there anything else to do?

getzze avatar Apr 29 '25 15:04 getzze

Hi @getzze !

Apologies for the delay! Sorry I missed your previous comments, I'll do a quick pass today and merge it if everything looks good!

Thanks,

Divya

gitttt-1234 avatar Apr 29 '25 16:04 gitttt-1234

CI is failing because the conda-incubator/setup-miniconda action used in CI.yml is now pulling conda 25.3.0 and mamba 2.x. Before it pulled conda 24.x and mamba 1.x.

getzze avatar Apr 30 '25 12:04 getzze

Hey @gitttt-1234 , maybe this can be merged now?

getzze avatar Jun 04 '25 23:06 getzze