glenn-jocher
commited on
Commit
•
8ac96b7
1
Parent(s):
e899d6e
Fix for AP calculation limits 0.0 - 1.0 (#4563)
Browse filesThis PR brings alignment in AP computation practices with Detectron2 and MMDetection.
Problem first noted by @yusiyoh in https://github.com/ultralytics/yolov5/issues/4546
- utils/metrics.py +2 -2
utils/metrics.py
CHANGED
@@ -91,8 +91,8 @@ def compute_ap(recall, precision):
|
|
91 |
"""
|
92 |
|
93 |
# Append sentinel values to beginning and end
|
94 |
-
mrec = np.concatenate(([0.], recall, [
|
95 |
-
mpre = np.concatenate(([1.], precision, [0.]))
|
96 |
|
97 |
# Compute the precision envelope
|
98 |
mpre = np.flip(np.maximum.accumulate(np.flip(mpre)))
|
|
|
91 |
"""
|
92 |
|
93 |
# Append sentinel values to beginning and end
|
94 |
+
mrec = np.concatenate(([0.0], recall, [1.0]))
|
95 |
+
mpre = np.concatenate(([1.0], precision, [0.0]))
|
96 |
|
97 |
# Compute the precision envelope
|
98 |
mpre = np.flip(np.maximum.accumulate(np.flip(mpre)))
|