docstr: API for super resolution.
  
  Args:
      images (list(numpy.ndarray)): images data, shape of each is [H, W, C], the color space is BGR.
      paths (list[str]): The paths of images.
      data (dict): key is 'image', the corresponding value is the path to image.
      use_gpu (bool): Whether to use gpu.
      visualization (bool): Whether to save image or not.
      output_dir (str): The path to store output images.
  
  Returns:
      res (list[dict]): each element in the list is a dict, the keys and values are:
          save_path (str, optional): the path to save images. (Exists only if visualization is True)
          data (numpy.ndarray): data of post processed image.
docstr_tok: ["API","for","super","resolution",".","Args",":","images","(","list","(","numpy.ndarray",")",")",":","images","data",",","shape","of","each","is","[","H",",","W",",","C","]",",","the","color","space","is","BGR",".","paths","(","list","[","str","]",")",":","The","paths","of","images",".","data","(","dict",")",":","key","is","'image","'",",","the","corresponding","value","is","the","path","to","image",".","use_gpu","(","bool",")",":","Whether","to","use","gpu",".","visualization","(","bool",")",":","Whether","to","save","image","or","not",".","output_dir","(","str",")",":","The","path","to","store","output","images",".","Returns",":","res","(","list","[","dict","]",")",":","each","element","in","the","list","is","a","dict",",","the","keys","and","values","are",":","save_path","(","str",",","optional",")",":","the","path","to","save","images",".","(","Exists","only","if","visualization","is","True",")","data","(","numpy.ndarray",")",":","data","of","post","processed","image","."]
code: def bald(
      self,
      images=None,
      paths=None,
      data=None,
      use_gpu=False,
      org_labels=[
          [
              0.0,
              0.0,
              1.0,
              0.0,
              0.0,
              1.0,
              1.0,
              1.0,
              0.0,
              0.0,
              0.0,
              0.0,
              1.0,
          ]
      ],
      target_labels=None,
      visualization=True,
      output_dir="bald_output",
  ):
      """
      API for super resolution.
  
      Args:
          images (list(numpy.ndarray)): images data, shape of each is [H, W, C], the color space is BGR.
          paths (list[str]): The paths of images.
          data (dict): key is 'image', the corresponding value is the path to image.
          use_gpu (bool): Whether to use gpu.
          visualization (bool): Whether to save image or not.
          output_dir (str): The path to store output images.
  
      Returns:
          res (list[dict]): each element in the list is a dict, the keys and values are:
              save_path (str, optional): the path to save images. (Exists only if visualization is True)
              data (numpy.ndarray): data of post processed image.
      """
      if use_gpu:
          try:
              _places = os.environ["CUDA_VISIBLE_DEVICES"]
              int(_places[0])
          except:
              raise RuntimeError(
                  "Environment Variable CUDA_VISIBLE_DEVICES is not set correctly. If you wanna use gpu, please set CUDA_VISIBLE_DEVICES as cuda_device_id."
              )
  
      if data and "image" in data:
          if paths is None:
              paths = list()
          paths += data["image"]
  
      all_data = list()
      for yield_data in reader(
          images, paths, org_labels, target_labels
      ):
          all_data.append(yield_data)
  
      total_num = len(all_data)
      res = list()
      outputs = []
      for i in range(total_num):
          image_np = all_data[i]["img"]
          org_label_np = [all_data[i]["org_label"]]
          target_label_np = [all_data[i]["target_label"]]
          for j in range(5):
              if j % 2 == 0:
                  label_trg_tmp = copy.deepcopy(target_label_np)
                  new_i = 0
                  label_trg_tmp[0][new_i] = (
                      1.0 - label_trg_tmp[0][new_i]
                  )
                  label_trg_tmp = check_attribute_conflict(
                      label_trg_tmp
                  )
                  change_num = j * 0.02 + 0.3
                  label_org_tmp = list(
                      map(
                          lambda x: ((x * 2) - 1) * change_num,
                          org_label_np,
                      )
                  )
                  label_trg_tmp = list(
                      map(
                          lambda x: ((x * 2) - 1) * change_num,
                          label_trg_tmp,
                      )
                  )
  
                  predictor = (
                      self.gpu_predictor
                      if use_gpu
                      else self.cpu_predictor
                  )
                  input_names = predictor.get_input_names()
                  input_handle = predictor.get_input_handle(
                      input_names[0]
                  )
                  input_handle.copy_from_cpu(image_np.copy())
                  input_handle = predictor.get_input_handle(
                      input_names[1]
                  )
                  input_handle.copy_from_cpu(
                      np.array(label_org_tmp).astype("float32")
                  )
                  input_handle = predictor.get_input_handle(
                      input_names[2]
                  )
                  input_handle.copy_from_cpu(
                      np.array(label_trg_tmp).astype("float32")
                  )
                  predictor.run()
                  output_names = predictor.get_output_names()
                  output_handle = predictor.get_output_handle(
                      output_names[0]
                  )
                  outputs.append(output_handle)
  
          out = postprocess(
              data_out=outputs,
              org_im=all_data[i]["org_im"],
              org_im_path=all_data[i]["org_im_path"],
              output_dir=output_dir,
              visualization=visualization,
          )
          res.append(out)
      return res
  
file_path: PaddleHub/modules/image/Image_gan/gan/stgan_bald/module.py
imports: import os
  import copy
  import paddle
  import numpy
  from paddle.inference import Config, create_predictor
  from paddlehub.module.module import moduleinfo, serving
  from .data_feed import reader
  from .processor import postprocess, base64_to_cv2, cv2_to_base64
label_desc: Use image node_id 3 for calling the StganBald obj's underlying member method code with example usage: obj.bald(images, paths, data, use_gpu, org_labels, target_labels, visualization, output_dir) and returns: res