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
      use_dark(bool): whether to use postprocess in DarkPose
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","use_dark","(","bool",")",":","whether","to","use","postprocess","in","DarkPose"]
code: def predict_video(self, video_file, camera_id):
      video_name = "output.mp4"
      if camera_id != -1:
          capture = cv2.VideoCapture(camera_id)
      else:
          capture = cv2.VideoCapture(video_file)
          video_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_name)
      fourcc = cv2.VideoWriter_fourcc(*"mp4v")
      writer = cv2.VideoWriter(out_path, fourcc, fps, (width, height))
      index = 1
      while 1:
          ret, frame = capture.read()
          if not ret:
              break
          print("detect frame: %d" % (index))
          index += 1
          results = self.predict_image(
              [frame[:, :, ::-1]], visual=False
          )
          im_results = {}
          im_results["keypoint"] = [
              results["keypoint"],
              results["score"],
          ]
          im = visualize_pose(
              frame,
              im_results,
              visual_thresh=self.threshold,
              returnimg=True,
          )
          writer.write(im)
          if camera_id != -1:
              cv2.imshow("Mask Detection", im)
              if cv2.waitKey(1) & 0xFF == ord("q"):
                  break
      writer.release()
  
imports: import os
  import time
  import yaml
  import glob
  from functools import reduce
  from PIL import Image
  import cv2
  import math
  import numpy
  import paddle
  import sys
  from preprocess import preprocess, NormalizeImage, Permute
  from keypoint_preprocess import EvalAffine, TopDownEvalAffine, expand_crop
  from keypoint_postprocess import HrHRNetPostProcess, HRNetPostProcess
  from visualize import visualize_pose
  from paddle.inference import Config
  from paddle.inference import create_predictor
  from utils import argsparser, Timer, get_current_memory_mb
  from benchmark_utils import PaddleInferBenchmark
  from infer import Detector, get_test_images, print_arguments
label_desc: Use image node_id 7 for calling the KeyPointDetector obj's underlying member method code with example usage: obj.predict_video(video_file, camera_id) without return types