From 9a7b344fd0f11a7aeccff5d93804eb32b7653c46 Mon Sep 17 00:00:00 2001 From: Laughing <61612323+Laughing-q@users.noreply.github.com> Date: Fri, 8 Nov 2024 02:02:29 +0800 Subject: [PATCH] Fix duplicated annotations by `yolo_bbox2segment` (#17401) Co-authored-by: Burhan <62214284+Burhan-Q@users.noreply.github.com> --- ultralytics/data/converter.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ultralytics/data/converter.py b/ultralytics/data/converter.py index fa582141..6b87f4e8 100644 --- a/ultralytics/data/converter.py +++ b/ultralytics/data/converter.py @@ -636,8 +636,8 @@ def yolo_bbox2segment(im_dir, save_dir=None, sam_model="sam_b.pt"): continue line = (int(cls[i]), *s.reshape(-1)) texts.append(("%g " * len(line)).rstrip() % line) - with open(txt_file, "a") as f: - f.writelines(text + "\n" for text in texts) + with open(txt_file, "a") as f: + f.writelines(text + "\n" for text in texts) LOGGER.info(f"Generated segment labels saved in {save_dir}")