fix: prevent NaN propagation in MOT17 tracking metrics#556
Conversation
There was a problem hiding this comment.
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>
983942e to
0fa470a
Compare
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: Fahmid-Arman The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
Feedback addressed:
/assign @MooreZheng |
What type of PR is this?
/kind bug
What this PR does / why we need it:
When
motmetricscannot compute a value (e.g., zero valid detections), it outputsNaN. 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 theall_rank.csvleaderboard withNaNvalues and broke numeric sorting.math.isnan()andmath.isinf()guard to the final return statement in all five tracking metric scripts.0.0instead of corrupting the CSV downstream.mathandloggingimports to support the guard.Which issue(s) this PR fixes:
Fixes #448