From 381a964f2dda29436a7fc2ee842d532a02ed8aab Mon Sep 17 00:00:00 2001 From: Takumi Karasawa Date: Sun, 29 Aug 2021 22:08:27 +0900 Subject: [PATCH] Fix bug in `plot_one_box` when label is `None` (#4588) --- utils/plots.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/utils/plots.py b/utils/plots.py index 76c161a13d1a..25d70dbabc75 100644 --- a/utils/plots.py +++ b/utils/plots.py @@ -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