From 82968f5df92f1c0cb87c91fd3bf5b93c6d839867 Mon Sep 17 00:00:00 2001 From: shiyutang <34859558+shiyutang@users.noreply.github.com> Date: Thu, 27 Jul 2023 10:25:17 +0800 Subject: [PATCH] [BugFix] Import error (#8476) * fix_textbbox * compact_py37 * update_req * fix_deploy_cannot_find * fix_merge_error --- deploy/pptracking/python/mot/visualize.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/deploy/pptracking/python/mot/visualize.py b/deploy/pptracking/python/mot/visualize.py index 66d3a66eb..70ec9613b 100644 --- a/deploy/pptracking/python/mot/visualize.py +++ b/deploy/pptracking/python/mot/visualize.py @@ -21,8 +21,15 @@ import PIL from PIL import Image, ImageDraw, ImageFile ImageFile.LOAD_TRUNCATED_IMAGES = True from collections import deque -from ppdet.utils.compact import imagedraw_textsize_c +def imagedraw_textsize_c(draw, text): + if int(PIL.__version__.split('.')[0]) < 10: + tw, th = draw.textsize(text) + else: + left, top, right, bottom = draw.textbbox((0, 0), text) + tw, th = right - left, bottom - top + + return tw, th def imagedraw_textsize_c(draw, text): if int(PIL.__version__.split('.')[0]) < 10: -- GitLab