code: def visualize(
      image_list, result, labels, output_dir="output/", threshold=0.5
  ):
      # visualize the predict result
      start_idx = 0
      for idx, image_file in enumerate(image_list):
          im_bboxes_num = result["boxes_num"][idx]
          im_results = {}
          if "boxes" in result:
              im_results["boxes"] = result["boxes"][
                  start_idx : start_idx + im_bboxes_num, :
              ]
          start_idx += im_bboxes_num
          im = visualize_box_mask(
              image_file, im_results, labels, threshold=threshold
          )
          img_name = os.path.split(image_file)[-1]
          if not os.path.exists(output_dir):
              os.makedirs(output_dir)
          out_path = os.path.join(output_dir, img_name)
          im.save(out_path, quality=95)
          print("save result to: " + out_path)
  
imports: import os
  import yaml
  import glob
  from functools import reduce
  import cv2
  import numpy
  import math
  import paddle
  from paddle.inference import Config
  from paddle.inference import create_predictor
  import sys
  from benchmark_utils import PaddleInferBenchmark
  from picodet_postprocess import PicoDetPostProcess
  from preprocess import preprocess, Resize, NormalizeImage, Permute, PadStride, LetterBoxResize, Pad, decode_image
  from mot.visualize import visualize_box_mask
  from mot_utils import argsparser, Timer, get_current_memory_mb
label_desc: Use image node_id 5 for calling a global function with example usage: visualize(image_list, result, labels, output_dir, threshold) without return types