Skip to content

Commit

Permalink
Fix bug in plot_one_box when label is None (ultralytics#4588)
Browse files Browse the repository at this point in the history
  • Loading branch information
karasawatakumi authored and CesarBazanAV committed Sep 29, 2021
1 parent 531f4e3 commit a63911b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion utils/plots.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def plot_one_box(box, im, color=(128, 128, 128), txt_color=(255, 255, 255), labe
assert im.data.contiguous, 'Image not contiguous. Apply np.ascontiguousarray(im) to plot_on_box() input image.'
lw = line_width or max(int(min(im.size) / 200), 2) # line width

if use_pil or not is_ascii(label): # use PIL
if use_pil or (label is not None and not is_ascii(label)): # use PIL
im = Image.fromarray(im)
draw = ImageDraw.Draw(im)
draw.rectangle(box, width=lw + 1, outline=color) # plot
Expand Down

0 comments on commit a63911b

Please sign in to comment.