diff --git a/deploy/pptracking/python/visualize.py b/deploy/pptracking/python/visualize.py index 4320b405e0ab86309293d182736af064825efb02..58de0a966f5c69eeef035fe6e2cafbf3f7ffbc8f 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))