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 predict_mtmct(self, mtmct_dir, mtmct_cfg):
      cameras_bias = mtmct_cfg["cameras_bias"]
      cid_bias = parse_bias(cameras_bias)
      scene_cluster = list(cid_bias.keys())
      # 1.zone releated parameters
      use_zone = mtmct_cfg.get("use_zone", False)
      zone_path = mtmct_cfg.get("zone_path", None)
  
      # 2.tricks parameters, can be used for other mtmct dataset
      use_ff = mtmct_cfg.get("use_ff", False)
      use_rerank = mtmct_cfg.get("use_rerank", False)
  
      # 3.camera releated parameters
      use_camera = mtmct_cfg.get("use_camera", False)
      use_st_filter = mtmct_cfg.get("use_st_filter", False)
  
      # 4.zone releated parameters
      use_roi = mtmct_cfg.get("use_roi", False)
      roi_dir = mtmct_cfg.get("roi_dir", False)
  
      mot_list_breaks = []
      cid_tid_dict = dict()
  
      output_dir = self.output_dir
      if not os.path.exists(output_dir):
          os.makedirs(output_dir)
  
      seqs = os.listdir(mtmct_dir)
      for seq in sorted(seqs):
          fpath = os.path.join(mtmct_dir, seq)
          if os.path.isfile(fpath) and _is_valid_video(fpath):
              seq = seq.split(".")[-2]
              print("ffmpeg processing of video {}".format(fpath))
              frames_path = video2frames(
                  video_path=fpath, outpath=mtmct_dir, frame_rate=25
              )
              fpath = os.path.join(mtmct_dir, seq)
  
          if os.path.isdir(fpath) == False:
              print("{} is not a image folder.".format(fpath))
              continue
          if os.path.exists(os.path.join(fpath, "img1")):
              fpath = os.path.join(fpath, "img1")
          assert os.path.isdir(
              fpath
          ), "{} should be a directory".format(fpath)
          image_list = glob.glob(os.path.join(fpath, "*.jpg"))
          image_list.sort()
          assert len(image_list) > 0, "{} has no images.".format(fpath)
          print("start tracking seq: {}".format(seq))
  
          mot_features_dict = self.predict_image(
              image_list, visual=False, seq_name=seq
          )
  
          cid = int(re.sub("[a-z,A-Z]", "", seq))
          tid_data, mot_list_break = trajectory_fusion(
              mot_features_dict,
              cid,
              cid_bias,
              use_zone=use_zone,
              zone_path=zone_path,
          )
          mot_list_breaks.append(mot_list_break)
          # single seq process
          for line in tid_data:
              tracklet = tid_data[line]
              tid = tracklet["tid"]
              if (cid, tid) not in cid_tid_dict:
                  cid_tid_dict[(cid, tid)] = tracklet
  
      map_tid = sub_cluster(
          cid_tid_dict,
          scene_cluster,
          use_ff=use_ff,
          use_rerank=use_rerank,
          use_camera=use_camera,
          use_st_filter=use_st_filter,
      )
  
      pred_mtmct_file = os.path.join(output_dir, "mtmct_result.txt")
      if use_camera:
          gen_res(
              pred_mtmct_file, scene_cluster, map_tid, mot_list_breaks
          )
      else:
          gen_res(
              pred_mtmct_file,
              scene_cluster,
              map_tid,
              mot_list_breaks,
              use_roi=use_roi,
              roi_dir=roi_dir,
          )
  
      camera_results, cid_tid_fid_res = get_mtmct_matching_results(
          pred_mtmct_file
      )
  
      crops_dir = os.path.join(output_dir, "mtmct_crops")
      save_mtmct_crops(
          cid_tid_fid_res, images_dir=mtmct_dir, crops_dir=crops_dir
      )
  
      save_dir = os.path.join(output_dir, "mtmct_vis")
      save_mtmct_vis_results(
          camera_results,
          images_dir=mtmct_dir,
          save_dir=save_dir,
          save_videos=FLAGS.save_images,
      )
  
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 7 for calling the SDE_Detector obj's underlying member method code with example usage: obj.predict_mtmct(mtmct_dir, mtmct_cfg) without return types