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
      draw_center_traj (bool): Whether drawing the trajectory of center, default as False
      secs_interval (int): The seconds interval to count after tracking, default as 10
      skip_frame_num (int): Skip frame num to get faster MOT results, default as -1
      warmup_frame (int):Warmup frame num to test speed of MOT,default as 50
      do_entrance_counting(bool): Whether counting the numbers of identifiers entering 
          or getting out from the entrance, default as False，only support single class
          counting in MOT, and the video should be taken by a static camera.
      do_break_in_counting(bool): Whether counting the numbers of identifiers break in
          the area, default as False，only support single class counting in MOT,
          and the video should be taken by a static camera.
      region_type (str): Area type for entrance counting or break in counting, 'horizontal'
          and 'vertical' used when do entrance counting. 'custom' used when do break in counting. 
          Note that only support single-class MOT, and the video should be taken by a static camera.
      region_polygon (list): Clockwise point coords (x0,y0,x1,y1...) of polygon of area when
          do_break_in_counting. Note that only support single-class MOT and
          the video should be taken by a static camera.
      reid_model_dir (str): reid model dir, default None for ByteTrack, but set for DeepSORT
      mtmct_dir (str): MTMCT dir, default None, set for doing MTMCT
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","draw_center_traj","(","bool",")",":","Whether","drawing","the","trajectory","of","center",",","default","as","False","secs_interval","(","int",")",":","The","seconds","interval","to","count","after","tracking",",","default","as","10","skip_frame_num","(","int",")",":","Skip","frame","num","to","get","faster","MOT","results",",","default","as","-1","warmup_frame","(","int",")",":","Warmup","frame","num","to","test","speed","of","MOT",",","default","as","50","do_entrance_counting","(","bool",")",":","Whether","counting","the","numbers","of","identifiers","entering","or","getting","out","from","the","entrance",",","default","as","False\uff0conly","support","single","class","counting","in","MOT",",","and","the","video","should","be","taken","by","a","static","camera",".","do_break_in_counting","(","bool",")",":","Whether","counting","the","numbers","of","identifiers","break","in","the","area",",","default","as","False\uff0conly","support","single","class","counting","in","MOT",",","and","the","video","should","be","taken","by","a","static","camera",".","region_type","(","str",")",":","Area","type","for","entrance","counting","or","break","in","counting",",","'horizontal'","and","'vertical","'","used","when","do","entrance","counting",".","'custom","'","used","when","do","break","in","counting",".","Note","that","only","support","single-class","MOT",",","and","the","video","should","be","taken","by","a","static","camera",".","region_polygon","(","list",")",":","Clockwise","point","coords","(","x0",",","y0",",","x1",",","y1","...",")","of","polygon","of","area","when","do_break_in_counting",".","Note","that","only","support","single-class","MOT","and","the","video","should","be","taken","by","a","static","camera",".","reid_model_dir","(","str",")",":","reid","model","dir",",","default","None","for","ByteTrack",",","but","set","for","DeepSORT","mtmct_dir","(","str",")",":","MTMCT","dir",",","default","None",",","set","for","doing","MTMCT"]
code: def reidprocess(self, det_results, repeats=1):
      pred_dets = det_results["boxes"]  # cls_id, score, x0, y0, x1, y1
      pred_xyxys = pred_dets[:, 2:6]
  
      ori_image = det_results["ori_image"]
      ori_image_shape = ori_image.shape[:2]
      pred_xyxys, keep_idx = clip_box(pred_xyxys, ori_image_shape)
  
      if len(keep_idx[0]) == 0:
          det_results["boxes"] = np.zeros((1, 6), dtype=np.float32)
          det_results["embeddings"] = None
          return det_results
  
      pred_dets = pred_dets[keep_idx[0]]
      pred_xyxys = pred_dets[:, 2:6]
  
      w, h = self.tracker.input_size
      crops = get_crops(pred_xyxys, ori_image, w, h)
  
      # to keep fast speed, only use topk crops
      crops = crops[:50]  # reid_batch_size
      det_results["crops"] = np.array(crops).astype("float32")
      det_results["boxes"] = pred_dets[:50]
  
      input_names = self.reid_predictor.get_input_names()
      for i in range(len(input_names)):
          input_tensor = self.reid_predictor.get_input_handle(
              input_names[i]
          )
          input_tensor.copy_from_cpu(det_results[input_names[i]])
  
      # model prediction
      for i in range(repeats):
          self.reid_predictor.run()
          output_names = self.reid_predictor.get_output_names()
          feature_tensor = self.reid_predictor.get_output_handle(
              output_names[0]
          )
          pred_embs = feature_tensor.copy_to_cpu()
  
      det_results["embeddings"] = pred_embs
      return det_results
  
imports: import os
  import time
  import yaml
  import cv2
  import re
  import glob
  import numpy
  from collections import defaultdict
  import paddle
  from benchmark_utils import PaddleInferBenchmark
  from preprocess import decode_image
  import sys
  from det_infer import Detector, get_test_images, print_arguments, bench_log, PredictConfig, load_predictor
  from mot_utils import argsparser, Timer, get_current_memory_mb, video2frames, _is_valid_video
  from mot.tracker import JDETracker, DeepSORTTracker, OCSORTTracker, BOTSORTTracker
  from mot.utils import MOTTimer, write_mot_results, get_crops, clip_box, flow_statistic
  from mot.visualize import plot_tracking, plot_tracking_dict
  from mot.mtmct.utils import parse_bias
  from mot.mtmct.postprocess import trajectory_fusion, sub_cluster, gen_res, print_mtmct_result
  from mot.mtmct.postprocess import get_mtmct_matching_results, save_mtmct_crops, save_mtmct_vis_results
label_desc: Use image node_id 3 for calling the SDE_Detector obj's underlying member method code with example usage: obj.reidprocess(det_results, repeats) and returns: det_results, det_results