Takumi Karasawa commited on
Commit
7b35971
·
unverified ·
1 Parent(s): bbfafea

Fix bug in `plot_one_box` when label is `None` (#4588)

Browse files
Files changed (1) hide show
  1. utils/plots.py +1 -1
utils/plots.py CHANGED
@@ -72,7 +72,7 @@ def plot_one_box(box, im, color=(128, 128, 128), txt_color=(255, 255, 255), labe
72
  assert im.data.contiguous, 'Image not contiguous. Apply np.ascontiguousarray(im) to plot_on_box() input image.'
73
  lw = line_width or max(int(min(im.size) / 200), 2) # line width
74
 
75
- if use_pil or not is_ascii(label): # use PIL
76
  im = Image.fromarray(im)
77
  draw = ImageDraw.Draw(im)
78
  draw.rectangle(box, width=lw + 1, outline=color) # plot
 
72
  assert im.data.contiguous, 'Image not contiguous. Apply np.ascontiguousarray(im) to plot_on_box() input image.'
73
  lw = line_width or max(int(min(im.size) / 200), 2) # line width
74
 
75
+ if use_pil or (label is not None and not is_ascii(label)): # use PIL
76
  im = Image.fromarray(im)
77
  draw = ImageDraw.Draw(im)
78
  draw.rectangle(box, width=lw + 1, outline=color) # plot