`ultralytics 8.3.23` fix `bbox2segment` when no segments generated (#17157)

Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
pull/17194/head v8.3.23
Laughing 1 month ago committed by GitHub
parent 61a45508f8
commit b5fd7f3378
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 2
      ultralytics/__init__.py
  2. 3
      ultralytics/data/converter.py

@ -1,6 +1,6 @@
# Ultralytics YOLO 🚀, AGPL-3.0 license
__version__ = "8.3.22"
__version__ = "8.3.23"
import os

@ -632,9 +632,10 @@ def yolo_bbox2segment(im_dir, save_dir=None, sam_model="sam_b.pt"):
txt_file = save_dir / lb_name
cls = label["cls"]
for i, s in enumerate(label["segments"]):
if len(s) == 0:
continue
line = (int(cls[i]), *s.reshape(-1))
texts.append(("%g " * len(line)).rstrip() % line)
if 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}")

Loading…
Cancel
Save