docstr: 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 image.
  direction_name(str): Attribute to be manipulated，For ffhq-conf-f, we have: age, eyes_open, eye_distance, eye_eyebrow_distance, eye_ratio, gender, lip_ratio, mouth_open, mouth_ratio, nose_mouth_distance, nose_ratio, nose_tip, pitch, roll, smile, yaw.
  direction_offset(float): Offset strength of the attribute.
  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: ["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","image",".","direction_name","(","str",")",":","Attribute","to","be","manipulated\uff0cFor","ffhq-conf-f",",","we","have",":","age",",","eyes_open",",","eye_distance",",","eye_eyebrow_distance",",","eye_ratio",",","gender",",","lip_ratio",",","mouth_open",",","mouth_ratio",",","nose_mouth_distance",",","nose_ratio",",","nose_tip",",","pitch",",","roll",",","smile",",","yaw",".","direction_offset","(","float",")",":","Offset","strength","of","the","attribute",".","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 generate(
      self,
      images=None,
      paths=None,
      direction_name="age",
      direction_offset=0.0,
      output_dir="./editing_result/",
      use_gpu=False,
      visualization=True,
  ):
      """
  
  
      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 image.
      direction_name(str): Attribute to be manipulated，For ffhq-conf-f, we have: age, eyes_open, eye_distance, eye_eyebrow_distance, eye_ratio, gender, lip_ratio, mouth_open, mouth_ratio, nose_mouth_distance, nose_ratio, nose_tip, pitch, roll, smile, yaw.
      direction_offset(float): Offset strength of the attribute.
      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.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
  
      if images != None:
          for image in images:
              image = image[:, :, ::-1]
              _, latent = self.pixel2style2pixel_module.network.run(
                  image
              )
              out = self.network.run(
                  latent, direction_name, direction_offset
              )
              results.append(out)
  
      if paths != None:
          for path in paths:
              image = cv2.imread(path)[:, :, ::-1]
              _, latent = self.pixel2style2pixel_module.network.run(
                  image
              )
              out = self.network.run(
                  latent, direction_name, direction_offset
              )
              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):
              if out is not None:
                  cv2.imwrite(
                      os.path.join(output_dir, "src_{}.png".format(i)),
                      out[0][:, :, ::-1],
                  )
                  cv2.imwrite(
                      os.path.join(output_dir, "dst_{}.png".format(i)),
                      out[1][:, :, ::-1],
                  )
                  np.save(
                      os.path.join(output_dir, "dst_{}.npy".format(i)),
                      out[2],
                  )
  
      return results
  
file_path: PaddleHub/modules/image/Image_gan/gan/styleganv2_editing/module.py
imports: import os
  import argparse
  import copy
  import paddle
  import paddlehub
  from paddlehub.module.module import moduleinfo, runnable, serving
  import numpy
  import cv2
  from skimage.io import imread
  from skimage.transform import rescale, resize
  from .model import StyleGANv2EditingPredictor
  from .util import base64_to_cv2
label_desc: Use image node_id 2 for calling the styleganv2_editing obj's underlying member method code with example usage: obj.generate(images, paths, direction_name, direction_offset, output_dir, use_gpu, visualization) and returns: results