-
Notifications
You must be signed in to change notification settings - Fork 3.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixed counting of tracks when calculating analytics report #8088
Conversation
Important Review skippedAuto incremental reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the WalkthroughThe recent update fixes an issue in the CVAT application's analytics reporting process. Specifically, it addresses inaccurate tracking of shapes in the Changes
Poem
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? TipsChatThere are 3 ways to chat with CodeRabbit:
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)
Additionally, you can add CodeRabbit Configration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (2)
- changelog.d/20240626_100703_boris_fixed_analytics.md (1 hunks)
- cvat/apps/analytics_report/report/primary_metrics/annotation_speed.py (1 hunks)
Additional comments not posted (1)
changelog.d/20240626_100703_boris_fixed_analytics.md (1)
1-4
: Changelog entry is clear and concise.The entry adequately summarizes the fix and provides a direct link to the relevant PR, helping in traceability.
if not track["shapes"]: | ||
continue | ||
|
||
if track["shapes"] and track["shapes"][0]["type"] == ShapeType.SKELETON: | ||
# skeleton's points are already counted as objects | ||
continue | ||
|
||
if len(track["shapes"]) == 1: | ||
count += self._db_obj.segment.stop_frame - track["shapes"][0]["frame"] + 1 | ||
continue | ||
|
||
# add initial frame here since only diff is added in the following loop | ||
count += 1 | ||
for prev_shape, cur_shape in zip(track["shapes"], track["shapes"][1:]): | ||
if not prev_shape["outside"]: | ||
count += cur_shape["frame"] - prev_shape["frame"] + 1 | ||
count += cur_shape["frame"] - prev_shape["frame"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Refined track counting logic enhances accuracy.
The changes ensure that empty shapes are skipped and handle scenarios where only one shape exists in a track more robustly, improving the accuracy of the count. However, consider adding comments to explain the logic behind counting frames and handling different scenarios for future maintainability.
+ # Skip processing if no shapes are associated with the track
if not track["shapes"]:
continue
+ # Skip skeleton shapes as their points are already counted
if track["shapes"] and track["shapes"][0]["type"] == ShapeType.SKELETON:
continue
+ # If only one shape exists, calculate the frames from the first frame to the stop frame of the segment
if len(track["shapes"]) == 1:
count += self._db_obj.segment.stop_frame - track["shapes"][0]["frame"] + 1
continue
+ # Add the initial frame count and then iterate through shapes to count non-outside frames
count += 1
for prev_shape, cur_shape in zip(track["shapes"], track["shapes"][1:]):
if not prev_shape["outside"]:
count += cur_shape["frame"] - prev_shape["frame"]
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
if not track["shapes"]: | |
continue | |
if track["shapes"] and track["shapes"][0]["type"] == ShapeType.SKELETON: | |
# skeleton's points are already counted as objects | |
continue | |
if len(track["shapes"]) == 1: | |
count += self._db_obj.segment.stop_frame - track["shapes"][0]["frame"] + 1 | |
continue | |
# add initial frame here since only diff is added in the following loop | |
count += 1 | |
for prev_shape, cur_shape in zip(track["shapes"], track["shapes"][1:]): | |
if not prev_shape["outside"]: | |
count += cur_shape["frame"] - prev_shape["frame"] + 1 | |
count += cur_shape["frame"] - prev_shape["frame"] | |
# Skip processing if no shapes are associated with the track | |
if not track["shapes"]: | |
continue | |
# Skip skeleton shapes as their points are already counted | |
if track["shapes"] and track["shapes"][0]["type"] == ShapeType.SKELETON: | |
# skeleton's points are already counted as objects | |
continue | |
# If only one shape exists, calculate the frames from the first frame to the stop frame of the segment | |
if len(track["shapes"]) == 1: | |
count += self._db_obj.segment.stop_frame - track["shapes"][0]["frame"] + 1 | |
continue | |
# Add the initial frame count and then iterate through shapes to count non-outside frames | |
count += 1 | |
for prev_shape, cur_shape in zip(track["shapes"], track["shapes"][1:]): | |
if not prev_shape["outside"]: | |
count += cur_shape["frame"] - prev_shape["frame"] |
Quality Gate passedIssues Measures |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #8088 +/- ##
===========================================
- Coverage 83.61% 83.60% -0.02%
===========================================
Files 383 383
Lines 40449 40460 +11
Branches 3819 3821 +2
===========================================
+ Hits 33822 33825 +3
- Misses 6627 6635 +8
|
Motivation and context
How has this been tested?
Checklist
develop
branch(cvat-canvas,
cvat-core,
cvat-data and
cvat-ui)
License
Feel free to contact the maintainers if that's a concern.
Summary by CodeRabbit