From ee6cf11378c5c398ac3f42ac6ca4e295223a1598 Mon Sep 17 00:00:00 2001 From: Glenn Jocher Date: Wed, 5 Jul 2023 17:14:53 +0200 Subject: [PATCH] Save Keypoints visible to text (#3547) Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- ultralytics/yolo/engine/results.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ultralytics/yolo/engine/results.py b/ultralytics/yolo/engine/results.py index c347da0..4e9f6f3 100644 --- a/ultralytics/yolo/engine/results.py +++ b/ultralytics/yolo/engine/results.py @@ -290,8 +290,8 @@ class Results(SimpleClass): seg = masks[j].xyn[0].copy().reshape(-1) # reversed mask.xyn, (n,2) to (n*2) line = (c, *seg) if kpts is not None: - kpt = kpts[j].xyn.reshape(-1).tolist() - line += (*kpt, ) + kpt = torch.cat((kpts[j].xyn, kpts[j].conf[..., None]), 2) if kpts[j].has_visible else kpts[j].xyn + line += (*kpt.reshape(-1).tolist(), ) line += (conf, ) * save_conf + (() if id is None else (id, )) texts.append(('%g ' * len(line)).rstrip() % line)