docstr: API of Classification.
  :param paths: the path of images.
  :type paths: list, each element is correspond to the path of an image.
  :param images: data of images, [N, H, W, C]
  :type images: numpy.ndarray
  :param use_gpu: whether to use gpu or not.
  :type use_gpu: bool
  :param batch_size: bathc size.
  :type batch_size: int
  :param top_k: result of top k
  :typr top_k: int
docstr_tok: ["API","of","Classification",".",":","param","paths",":","the","path","of","images",".",":","type","paths",":","list",",","each","element","is","correspond","to","the","path","of","an","image",".",":","param","images",":","data","of","images",",","[","N",",","H",",","W",",","C","]",":","type","images",":","numpy.ndarray",":","param","use_gpu",":","whether","to","use","gpu","or","not",".",":","type","use_gpu",":","bool",":","param","batch_size",":","bathc","size",".",":","type","batch_size",":","int",":","param","top_k",":","result","of","top","k",":","typr","top_k",":","int"]
code: def classification(
      self,
      paths=None,
      images=None,
      use_gpu=False,
      batch_size=1,
      top_k=2,
  ):
      """API of Classification.
      :param paths: the path of images.
      :type paths: list, each element is correspond to the path of an image.
      :param images: data of images, [N, H, W, C]
      :type images: numpy.ndarray
      :param use_gpu: whether to use gpu or not.
      :type use_gpu: bool
      :param batch_size: bathc size.
      :type batch_size: int
      :param top_k: result of top k
      :typr top_k: int
      """
      if self.infer_prog is None:
          inputs, outputs, self.infer_prog = self.context(
              trainable=False, pretrained=True, get_prediction=True
          )
          self.infer_prog = self.infer_prog.clone(for_test=True)
          self.pred_out = outputs["pred_out"]
      place = fluid.CUDAPlace(0) if use_gpu else fluid.CPUPlace()
      exe = fluid.Executor(place)
      all_images = []
      paths = paths if paths else []
      for yield_data in test_reader(paths, images):
          all_images.append(yield_data)
  
      images_num = len(all_images)
      loop_num = int(np.ceil(images_num / batch_size))
  
      res_list = []
      top_k = max(min(top_k, 1000), 1)
      for iter_id in range(loop_num):
          batch_data = []
          handle_id = iter_id * batch_size
          for image_id in range(batch_size):
              try:
                  batch_data.append(all_images[handle_id + image_id])
              except:
                  pass
          batch_data = np.array(batch_data).astype("float32")
          data_tensor = PaddleTensor(batch_data.copy())
          if use_gpu:
              result = self.gpu_predictor.run([data_tensor])
          else:
              result = self.cpu_predictor.run([data_tensor])
          for i, res in enumerate(result[0].as_ndarray()):
              res_dict = {}
              pred_label = np.argsort(res)[::-1][:top_k]
              for k in pred_label:
                  class_name = self.label_names[int(k)].split(",")[0]
                  max_prob = res[k]
                  res_dict[class_name] = max_prob
              res_list.append(res_dict)
      return res_list
  
imports: import os
  import ast
  import argparse
  import numpy
  import paddlehub
  import paddle.fluid
  from paddlehub.module.module import moduleinfo, runnable
  from paddle.fluid.core import PaddleTensor, AnalysisConfig, create_paddle_predictor
  from paddlehub.io.parser import txt_parser
  from resnet34_v2_imagenet.resnet import ResNet, ResNetC5
  from resnet34_v2_imagenet.processor import load_label_info
  from resnet34_v2_imagenet.data_feed import test_reader
label_desc: Use image node_id 8 for calling the ResNet34 obj's underlying member method code with example usage: obj.classification(paths, images, use_gpu, batch_size, top_k) and returns: res_list