From cf24349efbcc7a6a0e4e9e9654e9bda288cf78b5 Mon Sep 17 00:00:00 2001 From: Max <31512713+max-unfinity@users.noreply.github.com> Date: Sun, 12 May 2024 20:13:49 +0300 Subject: [PATCH] Fix bug in `Results.summary()` for masks and keypoints (#12629) Co-authored-by: Glenn Jocher --- ultralytics/engine/results.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ultralytics/engine/results.py b/ultralytics/engine/results.py index 2e1b60f4..5cfd9c5a 100644 --- a/ultralytics/engine/results.py +++ b/ultralytics/engine/results.py @@ -407,9 +407,9 @@ class Results(SimpleClass): class_id, conf = int(row.cls), round(row.conf.item(), decimals) box = (row.xyxyxyxy if is_obb else row.xyxy).squeeze().reshape(-1, 2).tolist() xy = {} - for i, b in enumerate(box): - xy[f"x{i + 1}"] = round(b[0] / w, decimals) - xy[f"y{i + 1}"] = round(b[1] / h, decimals) + for j, b in enumerate(box): + xy[f"x{j + 1}"] = round(b[0] / w, decimals) + xy[f"y{j + 1}"] = round(b[1] / h, decimals) result = {"name": self.names[class_id], "class": class_id, "confidence": conf, "box": xy} if data.is_track: result["track_id"] = int(row.id.item()) # track ID