code: def __init__(self, weight_path, gen_cfg):
      # 初始化模型
      gen = SPADEGenerator(
          gen_cfg.ngf,
          gen_cfg.num_upsampling_layers,
          gen_cfg.crop_size,
          gen_cfg.aspect_ratio,
          gen_cfg.norm_G,
          gen_cfg.semantic_nc,
          gen_cfg.use_vae,
          gen_cfg.nef,
      )
      gen.eval()
      para = load(weight_path)
      if "net_gen" in para:
          gen.set_state_dict(para["net_gen"])
      else:
          gen.set_state_dict(para)
  
      self.gen = gen
      self.gen_cfg = gen_cfg
  
file_path: PaddleHub/modules/image/Image_gan/gan/photopen/model.py
imports: import os
  import cv2
  import numpy
  import paddle
  from PIL import Image
  from PIL import ImageOps
  from ppgan.models.generators import SPADEGenerator
  from ppgan.utils.filesystem import load
  from ppgan.utils.photopen import data_onehot_pro
label_desc: Use image node_id 1 to create a new PhotoPenPredictor object  with example: obj = PhotoPenPredictor(weight_path, gen_cfg)