docstr: Denoise a raw image in the low-light scene.
  
  images (list[numpy.ndarray]): data of images, shape of each is [H, W], must be sing-channel image captured by camera.
  paths (list[str]): paths to images
  output_dir: the dir to save the results
  use_gpu: if True, use gpu to perform the computation, otherwise cpu.
  visualization: if True, save results in output_dir.
docstr_tok: ["Denoise","a","raw","image","in","the","low-light","scene",".","images","(","list","[","numpy.ndarray","]",")",":","data","of","images",",","shape","of","each","is","[","H",",","W","]",",","must","be","sing-channel","image","captured","by","camera",".","paths","(","list","[","str","]",")",":","paths","to","images","output_dir",":","the","dir","to","save","the","results","use_gpu",":","if","True",",","use","gpu","to","perform","the","computation",",","otherwise","cpu",".","visualization",":","if","True",",","save","results","in","output_dir","."]
code: def denoising(
      self,
      images: list = None,
      paths: list = None,
      output_dir: str = "./enlightening_result/",
      use_gpu: bool = False,
      visualization: bool = True,
  ):
      """
      Denoise a raw image in the low-light scene.
  
      images (list[numpy.ndarray]): data of images, shape of each is [H, W], must be sing-channel image captured by camera.
      paths (list[str]): paths to images
      output_dir: the dir to save the results
      use_gpu: if True, use gpu to perform the computation, otherwise cpu.
      visualization: if True, save results in output_dir.
      """
      results = []
      paddle.enable_static()
      exe, prog, inputs, outputs = self.set_device(use_gpu)
  
      if images != None:
          for raw in images:
              input_full = np.expand_dims(pack_raw(raw), axis=0) * 300
              px = input_full.shape[1] // 512
              py = input_full.shape[2] // 512
              rx, ry = px * 512, py * 512
              input_full = input_full[:, :rx, :ry, :]
              output = np.random.randn(rx * 2, ry * 2, 3)
              input_full = np.minimum(input_full, 1.0)
              for i in range(px):
                  for j in range(py):
                      input_patch = input_full[
                          :,
                          i * 512 : i * 512 + 512,
                          j * 512 : j * 512 + 512,
                          :,
                      ]
                      result = exe.run(
                          prog,
                          feed={inputs[0]: input_patch},
                          fetch_list=outputs,
                      )
                      output[
                          i * 512 * 2 : i * 512 * 2 + 512 * 2,
                          j * 512 * 2 : j * 512 * 2 + 512 * 2,
                          :,
                      ] = result[0][0]
              output = np.minimum(np.maximum(output, 0), 1)
              output = output * 255
              output = np.clip(output, 0, 255)
              output = output.astype("uint8")
              results.append(output)
      if paths != None:
          for path in paths:
              raw = rawpy.imread(path)
              input_full = np.expand_dims(pack_raw(raw), axis=0) * 300
              px = input_full.shape[1] // 512
              py = input_full.shape[2] // 512
              rx, ry = px * 512, py * 512
              input_full = input_full[:, :rx, :ry, :]
              output = np.random.randn(rx * 2, ry * 2, 3)
              input_full = np.minimum(input_full, 1.0)
              for i in range(px):
                  for j in range(py):
                      input_patch = input_full[
                          :,
                          i * 512 : i * 512 + 512,
                          j * 512 : j * 512 + 512,
                          :,
                      ]
                      result = exe.run(
                          prog,
                          feed={inputs[0]: input_patch},
                          fetch_list=outputs,
                      )
                      output[
                          i * 512 * 2 : i * 512 * 2 + 512 * 2,
                          j * 512 * 2 : j * 512 * 2 + 512 * 2,
                          :,
                      ] = result[0][0]
              output = np.minimum(np.maximum(output, 0), 1)
              output = output * 255
              output = np.clip(output, 0, 255)
              output = output.astype("uint8")
              results.append(output)
  
      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/seeinthedark/module.py
imports: import os
  import argparse
  import paddle
  import paddlehub
  from paddlehub.module.module import moduleinfo, runnable, serving
  import numpy
  import rawpy
  import cv2
  from .util import base64_to_cv2
label_desc: Use image node_id 3 for calling the LearningToSeeInDark obj's underlying member method code with example usage: obj.denoising(images, paths, output_dir, use_gpu, visualization) and returns: results