Skip to content

Commit 2d75f72

Browse files
deanmarkUltralyticsAssistantglenn-jocher
authored
Add plot_images conf_thresh parameter (#8446)
Co-authored-by: UltralyticsAssistant <web@ultralytics.com> Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
1 parent 30729d7 commit 2d75f72

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

ultralytics/utils/plotting.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -713,6 +713,7 @@ def plot_images(
713713
on_plot=None,
714714
max_subplots=16,
715715
save=True,
716+
conf_thres=0.25,
716717
):
717718
"""Plot image grid with labels."""
718719
if isinstance(images, torch.Tensor):
@@ -778,7 +779,7 @@ def plot_images(
778779
c = classes[j]
779780
color = colors(c)
780781
c = names.get(c, c) if names else c
781-
if labels or conf[j] > 0.25: # 0.25 conf thresh
782+
if labels or conf[j] > conf_thres:
782783
label = f"{c}" if labels else f"{c} {conf[j]:.1f}"
783784
annotator.box_label(box, label, color=color, rotated=is_obb)
784785

@@ -800,7 +801,7 @@ def plot_images(
800801
kpts_[..., 0] += x
801802
kpts_[..., 1] += y
802803
for j in range(len(kpts_)):
803-
if labels or conf[j] > 0.25: # 0.25 conf thresh
804+
if labels or conf[j] > conf_thres:
804805
annotator.kpts(kpts_[j])
805806

806807
# Plot masks
@@ -816,7 +817,7 @@ def plot_images(
816817

817818
im = np.asarray(annotator.im).copy()
818819
for j in range(len(image_masks)):
819-
if labels or conf[j] > 0.25: # 0.25 conf thresh
820+
if labels or conf[j] > conf_thres:
820821
color = colors(classes[j])
821822
mh, mw = image_masks[j].shape
822823
if mh != h or mw != w:

0 commit comments

Comments
 (0)