Skip to content

fix: prevent NaN propagation in MOT17 tracking metrics#556

Open
Fahmid-Arman wants to merge 1 commit into
kubeedge:mainfrom
Fahmid-Arman:fix-issue-448-mot17-nan-metrics
Open

fix: prevent NaN propagation in MOT17 tracking metrics#556
Fahmid-Arman wants to merge 1 commit into
kubeedge:mainfrom
Fahmid-Arman:fix-issue-448-mot17-nan-metrics

Conversation

@Fahmid-Arman

Copy link
Copy Markdown

What type of PR is this?
/kind bug

What this PR does / why we need it:
When motmetrics cannot compute a value (e.g., zero valid detections), it outputs NaN. Previously, five upstream tracking metric scripts (precision.py, recall.py, mota.py, motp.py, idf1.py) blindly cast this output to float and returned it, which silently corrupted the all_rank.csv leaderboard with NaN values and broke numeric sorting.

  • Added a math.isnan() and math.isinf() guard to the final return statement in all five tracking metric scripts.
  • When degenerate detection conditions occur, the pipeline now logs a warning and safely records 0.0 instead of corrupting the CSV downstream.
  • Added math and logging imports to support the guard.

Which issue(s) this PR fixes:
Fixes #448

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request adds safety checks for NaN and infinity values across several tracking metrics (idf1, mota, motp, precision, and recall) to return 0.0 when no valid detections are present. Feedback from the reviewer highlights two main issues across all modified files: first, overriding the imported loguru logger with the standard logging module silences info logs and bypasses global configurations; second, the warning logs use C-style formatting instead of loguru's brace-style formatting and print the metrics_name list directly instead of extracting the string element. It is recommended to use loguru directly and fix the log formatting and list indexing.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Signed-off-by: Fahmid Arman <fahmid.brac@gmail.com>
@Fahmid-Arman Fahmid-Arman force-pushed the fix-issue-448-mot17-nan-metrics branch from 983942e to 0fa470a Compare June 16, 2026 16:50
@kubeedge-bot

Copy link
Copy Markdown
Collaborator

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: Fahmid-Arman
To complete the pull request process, please assign moorezheng after the PR has been reviewed.
You can assign the PR to them by writing /assign @moorezheng in a comment when ready.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@kubeedge-bot kubeedge-bot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. kind/bug Categorizes issue or PR as related to a bug. labels Jun 16, 2026
@Fahmid-Arman

Copy link
Copy Markdown
Author

Feedback addressed:

  • Removed standard logging overrides to preserve loguru global configurations and INFO visibility.
  • Refactored warnings to use native brace-style formatting and explicitly indexed metrics_name[0] to prevent list stringification.

/assign @MooreZheng

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/bug Categorizes issue or PR as related to a bug. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[MOT17] NaN propagation from upstream tracking metrics corrupts leaderboard CSV

3 participants