docstr: enlighten images in the low-light scene.
  
  images (list[numpy.ndarray]): data of images, shape of each is [H, W, C], color space must be BGR(read by cv2).
  paths (list[str]): paths to images
  output_dir (str): the dir to save the results
  use_gpu (bool): if True, use gpu to perform the computation, otherwise cpu.
  visualization (bool): if True, save results in output_dir.
docstr_tok: ["enlighten","images","in","the","low-light","scene",".","images","(","list","[","numpy.ndarray","]",")",":","data","of","images",",","shape","of","each","is","[","H",",","W",",","C","]",",","color","space","must","be","BGR","(","read","by","cv2",")",".","paths","(","list","[","str","]",")",":","paths","to","images","output_dir","(","str",")",":","the","dir","to","save","the","results","use_gpu","(","bool",")",":","if","True",",","use","gpu","to","perform","the","computation",",","otherwise","cpu",".","visualization","(","bool",")",":","if","True",",","save","results","in","output_dir","."]
code: def enlightening(
      self,
      images: list = None,
      paths: list = None,
      output_dir: str = "./enlightening_result/",
      use_gpu: bool = False,
      visualization: bool = True,
  ):
      """
      enlighten images in the low-light scene.
  
      images (list[numpy.ndarray]): data of images, shape of each is [H, W, C], color space must be BGR(read by cv2).
      paths (list[str]): paths to images
      output_dir (str): the dir to save the results
      use_gpu (bool): if True, use gpu to perform the computation, otherwise cpu.
      visualization (bool): if True, save results in output_dir.
      """
      results = []
      paddle.disable_static()
      place = "gpu:0" if use_gpu else "cpu"
      place = paddle.set_device(place)
      if images == None and paths == None:
          print(
              "No image provided. Please input an image or a image path."
          )
          return
      self.model.eval()
  
      if images != None:
          for image in images:
              image = image[:, :, ::-1]
              image = np.expand_dims(
                  np.transpose(image, (2, 0, 1)).astype(np.float32)
                  / 255.0,
                  0,
              )
              inputtensor = paddle.to_tensor(image)
              out, out1 = self.model(inputtensor)
              out = out.numpy()[0]
              out = (np.transpose(out, (1, 2, 0)) + 1) / 2.0 * 255.0
              out = np.clip(out, 0, 255)
              out = out.astype("uint8")
              results.append(out)
  
      if paths != None:
          for path in paths:
              image = cv2.imread(path)[:, :, ::-1]
              image = np.expand_dims(
                  np.transpose(image, (2, 0, 1)).astype(np.float32)
                  / 255.0,
                  0,
              )
              inputtensor = paddle.to_tensor(image)
              out, out1 = self.model(inputtensor)
              out = out.numpy()[0]
              out = (np.transpose(out, (1, 2, 0)) + 1) / 2.0 * 255.0
              out = np.clip(out, 0, 255)
              out = out.astype("uint8")
              results.append(out)
  
      if visualization == True:
          if not os.path.exists(output_dir):
              os.makedirs(output_dir, exist_ok=True)
          for i, out in enumerate(results):
              cv2.imwrite(
                  os.path.join(output_dir, "output_{}.png".format(i)),
                  out[:, :, ::-1],
              )
  
      return results
  
file_path: PaddleHub/modules/image/image_processing/enlightengan/module.py
imports: import argparse
  import os
  import cv2
  import numpy
  import paddle
  import paddlehub
  from .enlighten_inference.pd_model.x2paddle_code import ONNXModel
  from .util import base64_to_cv2
  from paddlehub.module.module import moduleinfo
  from paddlehub.module.module import runnable
  from paddlehub.module.module import serving
label_desc: Use image node_id 2 for calling the EnlightenGAN obj's underlying member method code with example usage: obj.enlightening(images, paths, output_dir, use_gpu, visualization) and returns: results