mirror of
https://github.com/THU-MIG/yolov10.git
synced 2025-05-24 06:14:55 +08:00
Add plot_images conf_thresh
parameter (#8446)
Co-authored-by: UltralyticsAssistant <web@ultralytics.com> Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
This commit is contained in:
parent
30729d7346
commit
2d75f72598
@ -713,6 +713,7 @@ def plot_images(
|
|||||||
on_plot=None,
|
on_plot=None,
|
||||||
max_subplots=16,
|
max_subplots=16,
|
||||||
save=True,
|
save=True,
|
||||||
|
conf_thres=0.25,
|
||||||
):
|
):
|
||||||
"""Plot image grid with labels."""
|
"""Plot image grid with labels."""
|
||||||
if isinstance(images, torch.Tensor):
|
if isinstance(images, torch.Tensor):
|
||||||
@ -778,7 +779,7 @@ def plot_images(
|
|||||||
c = classes[j]
|
c = classes[j]
|
||||||
color = colors(c)
|
color = colors(c)
|
||||||
c = names.get(c, c) if names else c
|
c = names.get(c, c) if names else c
|
||||||
if labels or conf[j] > 0.25: # 0.25 conf thresh
|
if labels or conf[j] > conf_thres:
|
||||||
label = f"{c}" if labels else f"{c} {conf[j]:.1f}"
|
label = f"{c}" if labels else f"{c} {conf[j]:.1f}"
|
||||||
annotator.box_label(box, label, color=color, rotated=is_obb)
|
annotator.box_label(box, label, color=color, rotated=is_obb)
|
||||||
|
|
||||||
@ -800,7 +801,7 @@ def plot_images(
|
|||||||
kpts_[..., 0] += x
|
kpts_[..., 0] += x
|
||||||
kpts_[..., 1] += y
|
kpts_[..., 1] += y
|
||||||
for j in range(len(kpts_)):
|
for j in range(len(kpts_)):
|
||||||
if labels or conf[j] > 0.25: # 0.25 conf thresh
|
if labels or conf[j] > conf_thres:
|
||||||
annotator.kpts(kpts_[j])
|
annotator.kpts(kpts_[j])
|
||||||
|
|
||||||
# Plot masks
|
# Plot masks
|
||||||
@ -816,7 +817,7 @@ def plot_images(
|
|||||||
|
|
||||||
im = np.asarray(annotator.im).copy()
|
im = np.asarray(annotator.im).copy()
|
||||||
for j in range(len(image_masks)):
|
for j in range(len(image_masks)):
|
||||||
if labels or conf[j] > 0.25: # 0.25 conf thresh
|
if labels or conf[j] > conf_thres:
|
||||||
color = colors(classes[j])
|
color = colors(classes[j])
|
||||||
mh, mw = image_masks[j].shape
|
mh, mw = image_masks[j].shape
|
||||||
if mh != h or mw != w:
|
if mh != h or mw != w:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user