code: def __init__(self):
      super(Photo2Cartoon, self).__init__()
      # 加载人脸关键点检测模型
      self.face_detector = hub.Module(name="face_landmark_localization")
  
      # 加载人脸分割模型
      self.seg = hub.Module(name="FCN_HRNet_W18_Face_Seg")
  
      # 加载人脸动漫化模型
      self.net = ResnetGenerator(ngf=32, img_size=256, light=True)
  
      # 加载人脸动漫化模型参数
      state_dict = paddle.load(
          os.path.join(self.directory, "photo2cartoon_weights.pdparams")
      )
      self.net.set_state_dict(state_dict["genA2B"])
  
      # 将人脸动漫化模型设为评估模式
      self.net.eval()
  
file_path: PaddleHub/modules/image/Image_gan/style_transfer/Photo2Cartoon/module.py
imports: import os
  import cv2
  import math
  import paddle
  import numpy
  import paddle.nn
  import paddlehub
  from Photo2Cartoon.model import ResnetGenerator
  from paddlehub.module.module import moduleinfo
label_desc: Use image node_id 1 to create a new Photo2Cartoon object from inherited base classes: nn with example: obj = Photo2Cartoon()