From 710b40dcb1018f9fa560e5f17349878366c0ab37 Mon Sep 17 00:00:00 2001 From: Mohammed Yasin <32206511+Y-T-G@users.noreply.github.com> Date: Thu, 13 Feb 2025 12:39:26 +0800 Subject: [PATCH] Fix `print()` for ConfusionMatrix for Classify task (#19169) Signed-off-by: Mohammed Yasin <32206511+Y-T-G@users.noreply.github.com> --- 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 2b5821cb..7d9629ec 100644 --- a/ultralytics/utils/metrics.py +++ b/ultralytics/utils/metrics.py @@ -440,7 +440,7 @@ class ConfusionMatrix: def print(self): """Print the confusion matrix to the console.""" - for i in range(self.nc + 1): + for i in range(self.matrix.shape[0]): LOGGER.info(" ".join(map(str, self.matrix[i])))