diff --git a/deploy/pptracking/python/mot/visualize.py b/deploy/pptracking/python/mot/visualize.py index 66d3a66ebddde474670b95d98f5b24eb3fb647c4..70ec9613b18c870c7f121c8d87332f179ac8b37b 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: