Skip to content

Commit

Permalink
Fix for AP calculation limits 0.0 - 1.0 (ultralytics#4563)
Browse files Browse the repository at this point in the history
This PR brings alignment in AP computation practices with Detectron2 and MMDetection. 

Problem first noted by @yusiyoh in ultralytics#4546
  • Loading branch information
glenn-jocher authored and CesarBazanAV committed Sep 29, 2021
1 parent f261a65 commit f9d714f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions utils/metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@ def compute_ap(recall, precision):
"""

# Append sentinel values to beginning and end
mrec = np.concatenate(([0.], recall, [recall[-1] + 0.01]))
mpre = np.concatenate(([1.], precision, [0.]))
mrec = np.concatenate(([0.0], recall, [1.0]))
mpre = np.concatenate(([1.0], precision, [0.0]))

# Compute the precision envelope
mpre = np.flip(np.maximum.accumulate(np.flip(mpre)))
Expand Down

0 comments on commit f9d714f

Please sign in to comment.