code: def postprocess(
      data_out,
      org_im,
      org_im_path,
      output_dir,
      visualization,
      thresh=120,
  ):
      """
      Postprocess output of network. one image at a time.
  
      Args:
          data_out (numpy.ndarray): output of network.
          org_im (numpy.ndarray): original image.
          org_im_shape (list): shape pf original image.
          org_im_path (list): path of riginal image.
          output_dir (str): output directory to store image.
          visualization (bool): whether to save image or not.
          thresh (float): threshold.
  
      Returns:
          result (dict): The data of processed image.
      """
      result = dict()
      for i, img in enumerate(data_out):
          img = np.squeeze(img.copy_to_cpu(), 0).transpose((1, 2, 0))
          img = ((img + 1) * 127.5).astype(np.uint8)
          img = cv2.resize(img, (256, 341), cv2.INTER_CUBIC)
          fake_image = Image.fromarray(img)
  
          if visualization:
              check_dir(output_dir)
              save_im_path = get_save_image_name(
                  org_im_path, output_dir, i
              )
              img_name = "{}.png".format(i)
              fake_image.save(os.path.join(output_dir, img_name))
  
          result["data_{}".format(i)] = img
  
      return result
  
file_path: PaddleHub/modules/image/Image_gan/gan/stgan_bald/processor.py
imports: import os
  import base64
  import cv2
  import numpy
  from PIL import Image
label_desc: Use image node_id 3 for calling a global function with example usage: postprocess(data_out, org_im, org_im_path, output_dir, visualization, thresh) and returns: result