code: def visualize_vehicle_retrograde(im, mot_res, vehicle_retrograde_res):
      if isinstance(im, str):
          im = Image.open(im).convert("RGB")
      elif isinstance(im, np.ndarray):
          im = Image.fromarray(im)
  
      draw_thickness = min(im.size) // 320
      draw = ImageDraw.Draw(im)
  
      lane = vehicle_retrograde_res["fence_line"]
      if lane is not None:
          draw.line(
              [(lane[0], lane[1]), (lane[2], lane[3])],
              width=draw_thickness,
              fill=(0, 0, 0),
          )
  
      mot_id = vehicle_retrograde_res["output"]
      if mot_id is None or len(mot_id) == 0:
          return im
  
      if mot_res is None:
          return im
      np_boxes = mot_res["boxes"]
  
      if np_boxes is not None:
          for dt in np_boxes:
              if dt[0] not in mot_id:
                  continue
              bbox = dt[3:]
              if len(bbox) == 4:
                  xmin, ymin, xmax, ymax = bbox
                  # draw bbox
                  draw.line(
                      [
                          (xmin, ymin),
                          (xmin, ymax),
                          (xmax, ymax),
                          (xmax, ymin),
                          (xmin, ymin),
                      ],
                      width=draw_thickness,
                      fill=(0, 255, 0),
                  )
  
              # draw label
              text = "retrograde"
              tw, th = imagedraw_textsize_c(draw, text)
              draw.rectangle(
                  [(xmax + 1, ymin - th), (xmax + tw + 1, ymin)],
                  fill=(0, 255, 0),
              )
              draw.text((xmax + 1, ymin - th), text, fill=(0, 255, 0))
  
      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 15 for calling a global function with example usage: visualize_vehicle_retrograde(im, mot_res, vehicle_retrograde_res) and returns: im, im, im