From eec9155ee8c54ebcce167621ec7b5d9f2a1230d9 Mon Sep 17 00:00:00 2001 From: LDOUBLEV Date: Mon, 25 May 2020 20:31:40 +0800 Subject: [PATCH] adjust txt word in line --- tools/infer/utility.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tools/infer/utility.py b/tools/infer/utility.py index 43e68ea5..c7bb5876 100755 --- a/tools/infer/utility.py +++ b/tools/infer/utility.py @@ -176,12 +176,14 @@ def draw_ocr(image, boxes, txts, scores, draw_txt=True, drop_score=0.5): "./doc/simfang.ttf", font_size, encoding="utf-8") new_txt = str(count) + ': ' + txt + ' ' + '%.3f' % ( scores[count]) - while len(new_txt) > 25: + while len(new_txt) > 28: tmp = new_txt - new_txt = tmp[:25] + new_txt = tmp[:28] draw_txt.text( (20, gap * (count + 1)), new_txt, txt_color, font=font) - new_txt = tmp[25:] + new_txt = tmp[28:] + count += 1 + draw_txt.text( (20, gap * (count + 1)), new_txt, txt_color, font=font) count += 1 -- GitLab