code: def main():
      deploy_file = os.path.join(FLAGS.model_dir, "infer_cfg.yml")
      with open(deploy_file) as f:
          yml_conf = yaml.safe_load(f)
      arch = yml_conf["arch"]
      detector = SDE_Detector(
          FLAGS.model_dir,
          tracker_config=FLAGS.tracker_config,
          device=FLAGS.device,
          run_mode=FLAGS.run_mode,
          batch_size=1,
          trt_min_shape=FLAGS.trt_min_shape,
          trt_max_shape=FLAGS.trt_max_shape,
          trt_opt_shape=FLAGS.trt_opt_shape,
          trt_calib_mode=FLAGS.trt_calib_mode,
          cpu_threads=FLAGS.cpu_threads,
          enable_mkldnn=FLAGS.enable_mkldnn,
          output_dir=FLAGS.output_dir,
          threshold=FLAGS.threshold,
          save_images=FLAGS.save_images,
          save_mot_txts=FLAGS.save_mot_txts,
          draw_center_traj=FLAGS.draw_center_traj,
          secs_interval=FLAGS.secs_interval,
          skip_frame_num=FLAGS.skip_frame_num,
          warmup_frame=FLAGS.warmup_frame,
          do_entrance_counting=FLAGS.do_entrance_counting,
          do_break_in_counting=FLAGS.do_break_in_counting,
          region_type=FLAGS.region_type,
          region_polygon=FLAGS.region_polygon,
          reid_model_dir=FLAGS.reid_model_dir,
          mtmct_dir=FLAGS.mtmct_dir,
      )
  
      # predict from video file or camera video stream
      if FLAGS.video_file is not None or FLAGS.camera_id != -1:
          detector.predict_video(FLAGS.video_file, FLAGS.camera_id)
          detector.det_times.info(average=True)
      elif FLAGS.mtmct_dir is not None:
          with open(FLAGS.mtmct_cfg) as f:
              mtmct_cfg = yaml.safe_load(f)
          detector.predict_mtmct(FLAGS.mtmct_dir, mtmct_cfg)
      else:
          # predict from image
          if FLAGS.image_dir is None and FLAGS.image_file is not None:
              assert (
                  FLAGS.batch_size == 1
              ), "--batch_size should be 1 in MOT models."
          img_list = get_test_images(FLAGS.image_dir, FLAGS.image_file)
          seq_name = FLAGS.image_dir.split("/")[-1]
          detector.predict_image(
              img_list,
              FLAGS.run_benchmark,
              repeats=10,
              seq_name=seq_name,
          )
  
          if not FLAGS.run_benchmark:
              detector.det_times.info(average=True)
          else:
              mode = FLAGS.run_mode
              model_dir = FLAGS.model_dir
              model_info = {
                  "model_name": model_dir.strip("/").split("/")[-1],
                  "precision": mode.split("_")[-1],
              }
              bench_log(detector, img_list, model_info, name="MOT")
  
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 1 for calling a global function with example usage: main() without return types