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
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"]
code: def __init__(
      self,
      model_dir,
      device="CPU",
      run_mode="paddle",
      num_seg=8,
      seg_len=1,
      short_size=256,
      target_size=224,
      top_k=1,
      batch_size=1,
      trt_min_shape=1,
      trt_max_shape=1280,
      trt_opt_shape=640,
      trt_calib_mode=False,
      cpu_threads=1,
      enable_mkldnn=False,
      ir_optim=True,
  ):
      self.num_seg = num_seg
      self.seg_len = seg_len
      self.short_size = short_size
      self.target_size = target_size
      self.top_k = top_k
  
      assert (
          batch_size == 1
      ), "VideoActionRecognizer only support batch_size=1 now."
  
      self.model_dir = model_dir
      self.device = device
      self.run_mode = run_mode
      self.batch_size = batch_size
      self.trt_min_shape = trt_min_shape
      self.trt_max_shape = trt_max_shape
      self.trt_opt_shape = trt_opt_shape
      self.trt_calib_mode = trt_calib_mode
      self.cpu_threads = cpu_threads
      self.enable_mkldnn = enable_mkldnn
      self.ir_optim = ir_optim
  
      self.recognize_times = Timer()
  
      model_file_path = glob.glob(os.path.join(model_dir, "*.pdmodel"))[
          0
      ]
      params_file_path = glob.glob(
          os.path.join(model_dir, "*.pdiparams")
      )[0]
      self.config = Config(model_file_path, params_file_path)
  
      if device == "GPU" or device == "gpu":
          self.config.enable_use_gpu(8000, 0)
      elif device == "XPU" or device == "xpu":
          self.config.enable_xpu(10 * 1024 * 1024)
      elif device == "NPU" or device == "npu":
          self.config.enable_custom_device("npu")
      else:
          self.config.disable_gpu()
      if self.enable_mkldnn:
          # cache 10 different shapes for mkldnn to avoid memory leak
          self.config.set_mkldnn_cache_capacity(10)
          self.config.enable_mkldnn()
  
      self.config.switch_ir_optim(self.ir_optim)  # default true
  
      precision_map = {
          "trt_int8": Config.Precision.Int8,
          "trt_fp32": Config.Precision.Float32,
          "trt_fp16": Config.Precision.Half,
      }
      if run_mode in precision_map.keys():
          self.config.enable_tensorrt_engine(
              max_batch_size=8, precision_mode=precision_map[run_mode]
          )
  
      self.config.enable_memory_optim()
      # use zero copy
      self.config.switch_use_feed_fetch_ops(False)
  
      self.predictor = create_predictor(self.config)
  
imports: import os
  import yaml
  import glob
  import cv2
  import numpy
  import math
  import paddle
  import sys
  import paddle.nn.functional
  from paddle.inference import Config, create_predictor
  from python.utils import argsparser, Timer, get_current_memory_mb
  from python.benchmark_utils import PaddleInferBenchmark
  from python.infer import Detector, print_arguments
  from video_action_preprocess import VideoDecoder, Sampler, Scale, CenterCrop, Normalization, Image2Array
label_desc: Use image node_id 1 to create a new VideoActionRecognizer object from inherited base classes: object with example: obj = VideoActionRecognizer(model_dir, device, run_mode, num_seg, seg_len, short_size, target_size, top_k, batch_size, trt_min_shape, trt_max_shape, trt_opt_shape, trt_calib_mode, cpu_threads, enable_mkldnn, ir_optim)