docstr: API of Classification.
  
  Args:
      paths (list[str]): the path of mp4s.
      use_gpu (bool): whether to use gpu or not.
      threshold (float): the result value >= threshold will be returned.
      top_k (int): the top k result will be returned.
  
  Returns:
      results (list[dict]): every dict includes the mp4 file path and prediction.
docstr_tok: ["API","of","Classification",".","Args",":","paths","(","list","[","str","]",")",":","the","path","of","mp4s",".","use_gpu","(","bool",")",":","whether","to","use","gpu","or","not",".","threshold","(","float",")",":","the","result","value",">","=","threshold","will","be","returned",".","top_k","(","int",")",":","the","top","k","result","will","be","returned",".","Returns",":","results","(","list","[","dict","]",")",":","every","dict","includes","the","mp4","file","path","and","prediction","."]
code: def classify(self, paths, use_gpu=False, threshold=0.5, top_k=10):
      """
      API of Classification.
  
      Args:
          paths (list[str]): the path of mp4s.
          use_gpu (bool): whether to use gpu or not.
          threshold (float): the result value >= threshold will be returned.
          top_k (int): the top k result will be returned.
  
      Returns:
          results (list[dict]): every dict includes the mp4 file path and prediction.
      """
      args = self.parser.parse_args([])
      # config the args in videotag_tsn_lstm
      args.use_gpu = use_gpu
      args.filelist = paths
      args.topk = top_k
      args.threshold = threshold
      args.extractor_config = os.path.join(
          self.directory, "resource", "configs", "tsn.yaml"
      )
      args.predictor_config = os.path.join(
          self.directory, "resource", "configs", "attention_lstm.yaml"
      )
      args.extractor_weights = os.path.join(
          self.directory, "weights", "tsn"
      )
      args.predictor_weights = os.path.join(
          self.directory, "weights", "attention_lstm"
      )
      args.label_file = os.path.join(
          self.directory, "resource", "label_3396.txt"
      )
  
      check_cuda(args.use_gpu)
      check_version()
  
      if not self._has_load:
          self.place = (
              fluid.CUDAPlace(0) if args.use_gpu else fluid.CPUPlace()
          )
          self.exe = fluid.Executor(self.place)
          (
              self.extractor_main_prog,
              self.extractor_fetch_list,
              self.extractor_feeder,
              self.extractor_scope,
          ) = self._extractor(args, self.exe, self.place)
          (
              self.predictor_main_prog,
              self.predictor_fetch_list,
              self.predictor_feeder,
              self.predictor_scope,
          ) = self._predictor(args, self.exe, self.place)
          self._has_load = True
  
      extractor_config = parse_config(args.extractor_config)
      extractor_infer_config = merge_configs(
          extractor_config, "infer", vars(args)
      )
      extractor_reader = get_reader(
          "TSN", "infer", extractor_infer_config
      )
      feature_list = []
      file_list = []
  
      for idx, data in enumerate(extractor_reader()):
          file_id = [item[-1] for item in data]
          feed_data = [item[:-1] for item in data]
          feature_out = self.exe.run(
              program=self.extractor_main_prog,
              fetch_list=self.extractor_fetch_list,
              feed=self.extractor_feeder.feed(feed_data),
              scope=self.extractor_scope,
          )
          feature_list.append(feature_out)
          file_list.append(file_id)
          logger.info(
              "========[Stage 1 Sample {} ] Tsn feature extractor finished======".format(
                  idx
              )
          )
  
      # get AttentionLSTM input from Tsn output
      num_frames = 300
      predictor_feed_list = []
      for i in range(len(feature_list)):
          feature_out = feature_list[i]
          extractor_feature = feature_out[0]
          predictor_feed_data = [
              [extractor_feature[0].astype(float)[0:num_frames, :]]
          ]
          predictor_feed_list.append(
              (predictor_feed_data, file_list[i])
          )
  
      metrics_config = parse_config(args.predictor_config)
      metrics_config["MODEL"]["topk"] = args.topk
      metrics_config["MODEL"]["threshold"] = args.threshold
      predictor_metrics = get_metrics(
          "AttentionLSTM".upper(), "infer", metrics_config
      )
      predictor_metrics.reset()
      for idx, data in enumerate(predictor_feed_list):
          file_id = data[1]
          predictor_feed_data = data[0]
          final_outs = self.exe.run(
              program=self.predictor_main_prog,
              fetch_list=self.predictor_fetch_list,
              feed=self.predictor_feeder.feed(
                  predictor_feed_data,
              ),
              scope=self.predictor_scope,
          )
          logger.info(
              "=======[Stage 2 Sample {} ] AttentionLSTM predict finished========".format(
                  idx
              )
          )
          final_result_list = [item for item in final_outs] + [file_id]
  
          predictor_metrics.accumulate(final_result_list)
      results = predictor_metrics.finalize_and_log_out(
          label_file=args.label_file
      )
      return results
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import argparse
  import ast
  import os
  import paddle.fluid
  import paddlehub
  from paddlehub.module.module import moduleinfo, runnable
  from paddlehub.common.logger import logger
  from videotag_tsn_lstm.resource.utils.config_utils import *
  import videotag_tsn_lstm.resource.models
  from videotag_tsn_lstm.resource.reader import get_reader
  from videotag_tsn_lstm.resource.metrics import get_metrics
  from videotag_tsn_lstm.resource.utils.utility import check_cuda
  from videotag_tsn_lstm.resource.utils.utility import check_version
label_desc: Use image node_id 5 for calling the VideoTag obj's underlying member method code with example usage: obj.classify(paths, use_gpu, threshold, top_k) and returns: results