Small improvements to tracking
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
Nonevalue, 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_instancesto 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_pathvariable 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, andtracking-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
Trackerclass, 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.
- Integrated tracking logic directly into the
-
Tests
- Updated tracking tests to incorporate image scaling and parameterized testing for improved coverage.
- Adjusted expected outcomes in tracking integration tests for accuracy.
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_trackingfeature in theTrackerclass, 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
@coderabbitaiin 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
@coderabbitaiin 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 pauseto pause the reviews on a PR.@coderabbitai resumeto resume the paused reviews.@coderabbitai reviewto trigger an incremental review. This is useful when automatic reviews are disabled for the repository.@coderabbitai full reviewto do a full review from scratch and review all the files again.@coderabbitai summaryto regenerate the summary of the PR.@coderabbitai generate docstringsto generate docstrings for this PR.@coderabbitai resolveresolve all the CodeRabbit review comments.@coderabbitai planto trigger planning for file edits and PR creation.@coderabbitai configurationto show the current CodeRabbit configuration for the repository.@coderabbitai helpto get help.
Other keywords and placeholders
- Add
@coderabbitai ignoreanywhere in the PR description to prevent this PR from being reviewed. - Add
@coderabbitai summaryto generate the high-level summary at a specific location in the PR description. - Add
@coderabbitaianywhere in the PR title to generate the title automatically.
CodeRabbit Configuration File (.coderabbit.yaml)
- You can programmatically configure CodeRabbit by adding a
.coderabbit.yamlfile 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.
Also fixes a bug introduced by #1875, where the data_path variable was overwritten.
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.
It's ready for review!
Thanks for the updates @getzze! Just keep us posted on when it's ready for review again.
It's ready to review!
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
Hi @gitttt-1234, I just pushed the changes.
Thanks
Hi @gitttt-1234,
I rebased to develop and tests are passing.
@gitttt-1234 thanks for reviewing! I modified the code to address your points (I hope :) ).
@gitttt-1234 I made all the corrections, thanks!
Thanks @getzze ! Could you also resolve the errors caught in our CI tests?
@gitttt-1234 the tests should pass now
@gitttt-1234 Tests are passing and PR is rebased
@gitttt-1234 Everything good!
sorry to bug you @gitttt-1234 but is there anything else to do?
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
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.
Hey @gitttt-1234 , maybe this can be merged now?