Skip to content

Commit

Permalink
Fix for AP calculation limits 0.0 - 1.0 (#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/yolov5#4546
  • Loading branch information
MichaelAnderson-AI committed Aug 27, 2021
1 parent dbbd0d1 commit 7445c14
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 7445c14

Please sign in to comment.