class_docstr: Args:
      model_dir (str): root path of model.pdiparams, model.pdmodel and infer_cfg.yml
      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
class_docstr_tok: ["Args",":","model_dir","(","str",")",":","root","path","of","model.pdiparams",",","model.pdmodel","and","infer_cfg.yml","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"]
code: def predict_video(self, video_file, camera_id):
      video_out_name = "mot_output.mp4"
      if camera_id != -1:
          capture = cv2.VideoCapture(camera_id)
      else:
          capture = cv2.VideoCapture(video_file)
          video_out_name = os.path.split(video_file)[-1]
      # Get Video info : resolution, fps, frame count
      width = int(capture.get(cv2.CAP_PROP_FRAME_WIDTH))
      height = int(capture.get(cv2.CAP_PROP_FRAME_HEIGHT))
      fps = int(capture.get(cv2.CAP_PROP_FPS))
      frame_count = int(capture.get(cv2.CAP_PROP_FRAME_COUNT))
      print("fps: %d, frame_count: %d" % (fps, frame_count))
  
      if not os.path.exists(self.output_dir):
          os.makedirs(self.output_dir)
      out_path = os.path.join(self.output_dir, video_out_name)
      video_format = "mp4v"
      fourcc = cv2.VideoWriter_fourcc(*video_format)
      writer = cv2.VideoWriter(out_path, fourcc, fps, (width, height))
  
      frame_id = 1
      timer = MOTTimer()
      results = defaultdict(
          list
      )  # centertrack onpy support single class
      num_classes = self.num_classes
      data_type = "mcmot" if num_classes > 1 else "mot"
      ids2names = self.pred_config.labels
      while 1:
          ret, frame = capture.read()
          if not ret:
              break
          if frame_id % 10 == 0:
              print("Tracking frame: %d" % (frame_id))
          frame_id += 1
  
          timer.tic()
          seq_name = video_out_name.split(".")[0]
          mot_results = self.predict_image(
              [frame[:, :, ::-1]], visual=False, seq_name=seq_name
          )
          timer.toc()
  
          fps = 1.0 / timer.duration
          online_tlwhs, online_scores, online_ids = mot_results[0]
          results[0].append(
              (frame_id + 1, online_tlwhs, online_scores, online_ids)
          )
          im = plot_tracking(
              frame,
              online_tlwhs,
              online_ids,
              online_scores,
              frame_id=frame_id,
              fps=fps,
              ids2names=ids2names,
          )
  
          writer.write(im)
          if camera_id != -1:
              cv2.imshow("Mask Detection", im)
              if cv2.waitKey(1) & 0xFF == ord("q"):
                  break
  
      if self.save_mot_txts:
          result_filename = os.path.join(
              self.output_dir, video_out_name.split(".")[-2] + ".txt"
          )
  
          write_mot_results(
              result_filename, results, data_type, num_classes
          )
  
      writer.release()
  
imports: import os
  import copy
  import math
  import time
  import yaml
  import cv2
  import numpy
  from collections import defaultdict
  import paddle
  from benchmark_utils import PaddleInferBenchmark
  from utils import gaussian_radius, gaussian2D, draw_umich_gaussian
  from preprocess import preprocess, decode_image, WarpAffine, NormalizeImage, Permute
  from utils import argsparser, Timer, get_current_memory_mb
  from infer import Detector, get_test_images, print_arguments, bench_log, PredictConfig
  from keypoint_preprocess import get_affine_transform
  import sys
  from pptracking.python.mot import CenterTracker
  from pptracking.python.mot.utils import MOTTimer, write_mot_results
  from pptracking.python.mot.visualize import plot_tracking
label_desc: Use image node_id 9 for calling the CenterTrack obj's underlying member method code with example usage: obj.predict_video(video_file, camera_id) without return types