Fix for AP calculation limits 0.0 - 1.0 (#4563)
This PR brings alignment in AP computation practices with Detectron2 and MMDetection. Problem first noted by @yusiyoh in https://github.com/ultralytics/yolov5/issues/4546
This commit is contained in:
parent
e899d6e8fb
commit
8ac96b7975
|
|
@ -91,8 +91,8 @@ def compute_ap(recall, precision):
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# Append sentinel values to beginning and end
|
# Append sentinel values to beginning and end
|
||||||
mrec = np.concatenate(([0.], recall, [recall[-1] + 0.01]))
|
mrec = np.concatenate(([0.0], recall, [1.0]))
|
||||||
mpre = np.concatenate(([1.], precision, [0.]))
|
mpre = np.concatenate(([1.0], precision, [0.0]))
|
||||||
|
|
||||||
# Compute the precision envelope
|
# Compute the precision envelope
|
||||||
mpre = np.flip(np.maximum.accumulate(np.flip(mpre)))
|
mpre = np.flip(np.maximum.accumulate(np.flip(mpre)))
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue