code: def main():
      if not FLAGS.run_benchmark:
          assert FLAGS.batch_size == 1
          assert FLAGS.use_fp16 is False
      else:
          assert FLAGS.use_gpu is True
  
      recognizer = VideoActionRecognizer(
          FLAGS.model_dir,
          short_size=FLAGS.short_size,
          target_size=FLAGS.target_size,
          device=FLAGS.device,
          run_mode=FLAGS.run_mode,
          batch_size=FLAGS.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,
      )
  
      if not FLAGS.run_benchmark:
          classes, scores = recognizer.predict(FLAGS.video_file)
          print("Current video file: {}".format(FLAGS.video_file))
          print("\ttop-1 class: {0}".format(classes[0]))
          print("\ttop-1 score: {0}".format(scores[0]))
      else:
          cm, gm, gu = get_current_memory_mb()
          mems = {
              "cpu_rss_mb": cm,
              "gpu_rss_mb": gm,
              "gpu_util": gu * 100,
          }
  
          perf_info = recognizer.recognize_times.report()
          model_dir = FLAGS.model_dir
          mode = FLAGS.run_mode
          model_info = {
              "model_name": model_dir.strip("/").split("/")[-1],
              "precision": mode.split("_")[-1],
          }
          data_info = {
              "batch_size": FLAGS.batch_size,
              "shape": "dynamic_shape",
              "data_num": perf_info["img_num"],
          }
          recognize_log = PaddleInferBenchmark(
              recognizer.config, model_info, data_info, perf_info, mems
          )
          recognize_log("Fight")
  
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 2 for calling a global function with example usage: main() without return types