code: def save_vis_results(
      data,
      frame_id,
      online_ids,
      online_tlwhs,
      online_scores,
      average_time,
      show_image,
      save_dir,
      num_classes=1,
      ids2names=[],
  ):
      if show_image or save_dir is not None:
          assert "ori_image" in data
          img0 = data["ori_image"].numpy()[0]
          if online_ids is None:
              online_im = img0
          else:
              if isinstance(online_tlwhs, dict):
                  online_im = plot_tracking_dict(
                      img0,
                      num_classes,
                      online_tlwhs,
                      online_ids,
                      online_scores,
                      frame_id=frame_id,
                      fps=1.0 / average_time,
                      ids2names=ids2names,
                  )
              else:
                  online_im = plot_tracking(
                      img0,
                      online_tlwhs,
                      online_ids,
                      online_scores,
                      frame_id=frame_id,
                      fps=1.0 / average_time,
                      ids2names=ids2names,
                  )
      if show_image:
          cv2.imshow("online_im", online_im)
      if save_dir is not None:
          cv2.imwrite(
              os.path.join(save_dir, "{:05d}.jpg".format(frame_id)),
              online_im,
          )
  
imports: import os
  import cv2
  import time
  import numpy
  from .visualization import plot_tracking_dict, plot_tracking
label_desc: Use image node_id 2 for calling a global function with example usage: save_vis_results(data, frame_id, online_ids, online_tlwhs, online_scores, average_time, show_image, save_dir, num_classes, ids2names) without return types