class_docstr: Args:
      model_dir (str): root path of model.pdiparams, model.pdmodel and infer_cfg.yml
      tracker_config (str): tracker config path
      device (str): Choose the device you want to run, it can be: CPU/GPU/XPU/NPU, default is CPU
      run_mode (str): mode of running(paddle/trt_fp32/trt_fp16)
      batch_size (int): size of pre batch in inference
      trt_min_shape (int): min shape for dynamic shape in trt
      trt_max_shape (int): max shape for dynamic shape in trt
      trt_opt_shape (int): opt shape for dynamic shape in trt
      trt_calib_mode (bool): If the model is produced by TRT offline quantitative
          calibration, trt_calib_mode need to set True
      cpu_threads (int): cpu threads
      enable_mkldnn (bool): whether to open MKLDNN
      output_dir (string): The path of output, default as 'output'
      threshold (float): Score threshold of the detected bbox, default as 0.5
      save_images (bool): Whether to save visualization image results, default as False
      save_mot_txts (bool): Whether to save tracking results (txt), default as False
      reid_model_dir (str): reid model dir, default None for ByteTrack, but set for DeepSORT
class_docstr_tok: ["Args",":","model_dir","(","str",")",":","root","path","of","model.pdiparams",",","model.pdmodel","and","infer_cfg.yml","tracker_config","(","str",")",":","tracker","config","path","device","(","str",")",":","Choose","the","device","you","want","to","run",",","it","can","be",":","CPU\/GPU\/XPU\/NPU",",","default","is","CPU","run_mode","(","str",")",":","mode","of","running","(","paddle\/trt_fp32\/trt_fp16",")","batch_size","(","int",")",":","size","of","pre","batch","in","inference","trt_min_shape","(","int",")",":","min","shape","for","dynamic","shape","in","trt","trt_max_shape","(","int",")",":","max","shape","for","dynamic","shape","in","trt","trt_opt_shape","(","int",")",":","opt","shape","for","dynamic","shape","in","trt","trt_calib_mode","(","bool",")",":","If","the","model","is","produced","by","TRT","offline","quantitative","calibration",",","trt_calib_mode","need","to","set","True","cpu_threads","(","int",")",":","cpu","threads","enable_mkldnn","(","bool",")",":","whether","to","open","MKLDNN","output_dir","(","string",")",":","The","path","of","output",",","default","as","'output'","threshold","(","float",")",":","Score","threshold","of","the","detected","bbox",",","default","as","0.5","save_images","(","bool",")",":","Whether","to","save","visualization","image","results",",","default","as","False","save_mot_txts","(","bool",")",":","Whether","to","save","tracking","results","(","txt",")",",","default","as","False","reid_model_dir","(","str",")",":","reid","model","dir",",","default","None","for","ByteTrack",",","but","set","for","DeepSORT"]
code: def tracking(self, det_results):
      pred_dets = det_results[
          "boxes"
      ]  # 'cls_id, score, x0, y0, x1, y1'
      pred_embs = det_results.get("embeddings", None)
  
      if self.use_deepsort_tracker:
          # use DeepSORTTracker, only support singe class
          self.tracker.predict()
          online_targets = self.tracker.update(pred_dets, pred_embs)
          online_tlwhs, online_scores, online_ids = [], [], []
          for t in online_targets:
              if not t.is_confirmed() or t.time_since_update > 1:
                  continue
              tlwh = t.to_tlwh()
              tscore = t.score
              tid = t.track_id
              if (
                  self.tracker.vertical_ratio > 0
                  and tlwh[2] / tlwh[3] > self.tracker.vertical_ratio
              ):
                  continue
              online_tlwhs.append(tlwh)
              online_scores.append(tscore)
              online_ids.append(tid)
  
          tracking_outs = {
              "online_tlwhs": online_tlwhs,
              "online_scores": online_scores,
              "online_ids": online_ids,
          }
          return tracking_outs
      else:
          # use ByteTracker, support multiple class
          online_tlwhs = defaultdict(list)
          online_scores = defaultdict(list)
          online_ids = defaultdict(list)
          online_targets_dict = self.tracker.update(
              pred_dets, pred_embs
          )
          for cls_id in range(self.num_classes):
              online_targets = online_targets_dict[cls_id]
              for t in online_targets:
                  tlwh = t.tlwh
                  tid = t.track_id
                  tscore = t.score
                  if tlwh[2] * tlwh[3] <= self.tracker.min_box_area:
                      continue
                  if (
                      self.tracker.vertical_ratio > 0
                      and tlwh[2] / tlwh[3]
                      > self.tracker.vertical_ratio
                  ):
                      continue
                  online_tlwhs[cls_id].append(tlwh)
                  online_ids[cls_id].append(tid)
                  online_scores[cls_id].append(tscore)
  
          tracking_outs = {
              "online_tlwhs": online_tlwhs,
              "online_scores": online_scores,
              "online_ids": online_ids,
          }
          return tracking_outs
  
imports: import os
  import time
  import yaml
  import cv2
  import numpy
  from collections import defaultdict
  import paddle
  from benchmark_utils import PaddleInferBenchmark
  from preprocess import decode_image
  from utils import argsparser, Timer, get_current_memory_mb
  from infer import Detector, get_test_images, print_arguments, bench_log, PredictConfig, load_predictor
  import sys
  from pptracking.python.mot import JDETracker, DeepSORTTracker
  from pptracking.python.mot.utils import MOTTimer, write_mot_results, get_crops, clip_box
  from pptracking.python.mot.visualize import plot_tracking, plot_tracking_dict
label_desc: Use image node_id 4 for calling the SDE_Detector obj's underlying member method code with example usage: obj.tracking(det_results) and returns: tracking_outs, tracking_outs