code: def main():
      deploy_file = os.path.join(FLAGS.mot_model_dir, "infer_cfg.yml")
      with open(deploy_file) as f:
          yml_conf = yaml.safe_load(f)
      arch = yml_conf["arch"]
      mot_detector_func = "SDE_Detector"
      if arch in MOT_JDE_SUPPORT_MODELS:
          mot_detector_func = "JDE_Detector"
  
      mot_detector = eval(mot_detector_func)(
          FLAGS.mot_model_dir,
          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,
          threshold=FLAGS.mot_threshold,
          output_dir=FLAGS.output_dir,
      )
  
      topdown_keypoint_detector = KeyPointDetector(
          FLAGS.keypoint_model_dir,
          device=FLAGS.device,
          run_mode=FLAGS.run_mode,
          batch_size=FLAGS.keypoint_batch_size,
          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,
          threshold=FLAGS.keypoint_threshold,
          output_dir=FLAGS.output_dir,
          use_dark=FLAGS.use_dark,
      )
      keypoint_arch = topdown_keypoint_detector.pred_config.arch
      assert (
          KEYPOINT_SUPPORT_MODELS[keypoint_arch] == "keypoint_topdown"
      ), "MOT-Keypoint unite inference only supports topdown models."
  
      # predict from video file or camera video stream
      if FLAGS.video_file is not None or FLAGS.camera_id != -1:
          mot_topdown_unite_predict_video(
              mot_detector,
              topdown_keypoint_detector,
              FLAGS.camera_id,
              FLAGS.keypoint_batch_size,
              FLAGS.save_res,
          )
      else:
          # predict from image
          img_list = get_test_images(FLAGS.image_dir, FLAGS.image_file)
          mot_topdown_unite_predict(
              mot_detector,
              topdown_keypoint_detector,
              img_list,
              FLAGS.keypoint_batch_size,
              FLAGS.save_res,
          )
          if not FLAGS.run_benchmark:
              mot_detector.det_times.info(average=True)
              topdown_keypoint_detector.det_times.info(average=True)
          else:
              mode = FLAGS.run_mode
              mot_model_dir = FLAGS.mot_model_dir
              mot_model_info = {
                  "model_name": mot_model_dir.strip("/").split("/")[-1],
                  "precision": mode.split("_")[-1],
              }
              bench_log(
                  mot_detector, img_list, mot_model_info, name="MOT"
              )
  
              keypoint_model_dir = FLAGS.keypoint_model_dir
              keypoint_model_info = {
                  "model_name": keypoint_model_dir.strip("/").split(
                      "/"
                  )[-1],
                  "precision": mode.split("_")[-1],
              }
              bench_log(
                  topdown_keypoint_detector,
                  img_list,
                  keypoint_model_info,
                  FLAGS.keypoint_batch_size,
                  "KeyPoint",
              )
  
imports: import os
  import json
  import cv2
  import math
  import numpy
  import paddle
  import yaml
  import copy
  from collections import defaultdict
  from mot_keypoint_unite_utils import argsparser
  from preprocess import decode_image
  from infer import print_arguments, get_test_images, bench_log
  from mot_sde_infer import SDE_Detector
  from mot_jde_infer import JDE_Detector, MOT_JDE_SUPPORT_MODELS
  from keypoint_infer import KeyPointDetector, KEYPOINT_SUPPORT_MODELS
  from det_keypoint_unite_infer import predict_with_given_det
  from visualize import visualize_pose
  from benchmark_utils import PaddleInferBenchmark
  from utils import get_current_memory_mb
  from keypoint_postprocess import translate_to_ori_images
  import sys
  from pptracking.python.mot.visualize import plot_tracking, plot_tracking_dict
  from pptracking.python.mot.utils import MOTTimer
label_desc: Use image node_id 4 for calling a global function with example usage: main() without return types