From 24e9605685dad069d583c7bb3961c4b23b47e2a5 Mon Sep 17 00:00:00 2001 From: Feng Ni Date: Wed, 24 Nov 2021 18:38:22 +0800 Subject: [PATCH] [MOT] fix plot_tracking_dict (#4694) --- deploy/pptracking/python/visualize.py | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/deploy/pptracking/python/visualize.py b/deploy/pptracking/python/visualize.py index 4320b405e..58de0a966 100644 --- a/deploy/pptracking/python/visualize.py +++ b/deploy/pptracking/python/visualize.py @@ -205,14 +205,15 @@ def plot_tracking_dict(image, line_thickness = max(1, int(image.shape[1] / 500.)) if num_classes == 1: - start = records[-1].find('Total') - end = records[-1].find('In') - cv2.putText( - im, - records[-1][start:end], (0, int(40 * text_scale)), - cv2.FONT_HERSHEY_PLAIN, - text_scale, (0, 0, 255), - thickness=2) + if records is not None: + start = records[-1].find('Total') + end = records[-1].find('In') + cv2.putText( + im, + records[-1][start:end], (0, int(40 * text_scale)), + cv2.FONT_HERSHEY_PLAIN, + text_scale, (0, 0, 255), + thickness=2) if num_classes == 1 and do_entrance_counting: entrance_line = tuple(map(int, entrance)) -- GitLab