code: def visualize_attr(im, results, boxes=None, is_mtmct=False):
      if isinstance(im, str):
          im = Image.open(im)
          im = np.ascontiguousarray(np.copy(im))
          im = cv2.cvtColor(im, cv2.COLOR_RGB2BGR)
      else:
          im = np.ascontiguousarray(np.copy(im))
  
      im_h, im_w = im.shape[:2]
      text_scale = max(0.5, im.shape[0] / 3000.0)
      text_thickness = 1
  
      line_inter = im.shape[0] / 40.0
      for i, res in enumerate(results):
          if boxes is None:
              text_w = 3
              text_h = 1
          elif is_mtmct:
              box = boxes[i]  # multi camera, bbox shape is x,y, w,h
              text_w = int(box[0]) + 3
              text_h = int(box[1])
          else:
              box = boxes[
                  i
              ]  # single camera, bbox shape is 0, 0, x,y, w,h
              text_w = int(box[2]) + 3
              text_h = int(box[3])
          for text in res:
              text_h += int(line_inter)
              text_loc = (text_w, text_h)
              cv2.putText(
                  im,
                  text,
                  text_loc,
                  cv2.FONT_ITALIC,
                  text_scale,
                  (0, 255, 255),
                  thickness=text_thickness,
              )
      return im
  
imports: from __future__ import division
  import os
  import cv2
  import math
  import numpy
  import PIL
  from PIL import Image, ImageDraw, ImageFile
label_desc: Use image node_id 9 for calling a global function with example usage: visualize_attr(im, results, boxes, is_mtmct) and returns: im