From 4642d687ba43f7ef31fc7f933d588c3abdc5dfe6 Mon Sep 17 00:00:00 2001 From: Mohammed Yasin <32206511+Y-T-G@users.noreply.github.com> Date: Mon, 14 Oct 2024 21:58:37 +0800 Subject: [PATCH] Always return Precision metric regardless of `plot` arg (#16900) --- ultralytics/utils/metrics.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ultralytics/utils/metrics.py b/ultralytics/utils/metrics.py index fc9862dd36..2b80c02fe1 100644 --- a/ultralytics/utils/metrics.py +++ b/ultralytics/utils/metrics.py @@ -598,7 +598,7 @@ def ap_per_class( # AP from recall-precision curve for j in range(tp.shape[1]): ap[ci, j], mpre, mrec = compute_ap(recall[:, j], precision[:, j]) - if plot and j == 0: + if j == 0: prec_values.append(np.interp(x, mrec, mpre)) # precision at mAP@0.5 prec_values = np.array(prec_values) # (nc, 1000)