code: def __init__(self, args):
      self.args = args
  
      # Initialize generator and perceptual model
      tflib.init_tf()
      (
          generator_network,
          discriminator_network,
          Gs_network,
      ) = pretrained_networks.load_networks(args.model_url)
      self.generator = Generator(
          Gs_network,
          args.batch_size,
          randomize_noise=args.randomize_noise,
      )
  
      if args.dlatent_avg != "":
          self.generator.set_dlatent_avg(np.load(args.dlatent_avg))
  
      perc_model = None
      if args.use_lpips_loss > 0.00000001:
          if external.stylegan2.dnnlib.util.is_url(args.vgg_url):
              stream = external.stylegan2.dnnlib.util.open_url(
                  args.vgg_url, cache_dir="../.stylegan2-cache"
              )
          else:
              stream = open(args.vgg_url, "rb")
          with stream as f:
              perc_model = pickle.load(f)
  
      self.perceptual_model = PerceptualModel(
          args, perc_model=perc_model, batch_size=args.batch_size
      )
  
      self.ff_model = None
      if self.ff_model is None:
          if os.path.exists(self.args.load_resnet):
              from keras.applications.resnet50 import preprocess_input
  
              print("Loading ResNet Model:")
              self.ff_model = load_model(self.args.load_resnet)
              # self.ff_model._make_predict_function()
              dummy_im = np.zeros(
                  [
                      args.batch_size,
                      args.resnet_image_size,
                      args.resnet_image_size,
                      3,
                  ],
                  np.uint8,
              )
              self.ff_model.predict(preprocess_input(dummy_im))
      if self.ff_model is None:
          if os.path.exists(self.args.load_effnet):
              from efficientnet import preprocess_input
  
              print("Loading EfficientNet Model:")
              self.ff_model = load_model(self.args.load_effnet)
  
      self.perceptual_model.build_perceptual_model(
          self.generator, discriminator_network
      )
      self.perceptual_model.assign_placeholder(
          "id_loss", args.use_id_loss
      )
  
file_path: insightface/reconstruction/ostec/core/projection_handler.py
imports: import os
  import argparse
  import pickle
  from tqdm.auto import tqdm
  import PIL.Image
  from PIL import ImageFilter
  import numpy
  import external.stylegan2.dnnlib.tflib
  from external.stylegan2 import pretrained_networks
  from core.generator_model import Generator
  from core.perceptual_model import PerceptualModel, load_images
  import external.stylegan2.dnnlib
  from keras.models import load_model
  from keras.applications.resnet50 import preprocess_input
label_desc: Use image node_id 1 to create a new Projection_Handler object  with example: obj = Projection_Handler(args)