Allow show_conf to be used independently of show_labels in visualization (#23951)

Signed-off-by: Onuralp SEZER <onuralp@ultralytics.com>
Co-authored-by: Onuralp SEZER <onuralp@ultralytics.com>
Co-authored-by: Jing Qiu <61612323+Laughing-q@users.noreply.github.com>
This commit is contained in:
Saif Khan 2026-03-23 13:55:04 +05:30 committed by GitHub
parent 475e886fdb
commit aa78ea6b7e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -534,7 +534,7 @@ class Results(SimpleClass, DataExportMixin):
for i, d in enumerate(reversed(pred_boxes)):
c, d_conf, id = int(d.cls), float(d.conf) if conf else None, int(d.id.item()) if d.is_track else None
name = ("" if id is None else f"id:{id} ") + names[c]
label = (f"{name} {d_conf:.2f}" if conf else name) if labels else None
label = (f"{name} {d_conf:.2f}" if conf else name) if labels else (f"{d_conf:.2f}" if conf else None)
box = d.xyxyxyxy.squeeze() if is_obb else d.xyxy.squeeze()
annotator.box_label(
box,