Always return Precision metric regardless of `plot` arg (#16900)

pull/16912/head
Mohammed Yasin 1 month ago committed by GitHub
parent 6ec8e6ae55
commit 4642d687ba
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 2
      ultralytics/utils/metrics.py

@ -598,7 +598,7 @@ def ap_per_class(
# AP from recall-precision curve # AP from recall-precision curve
for j in range(tp.shape[1]): for j in range(tp.shape[1]):
ap[ci, j], mpre, mrec = compute_ap(recall[:, j], precision[:, j]) 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.append(np.interp(x, mrec, mpre)) # precision at mAP@0.5
prec_values = np.array(prec_values) # (nc, 1000) prec_values = np.array(prec_values) # (nc, 1000)

Loading…
Cancel
Save