code: def project_generated_images(
      network_pkl, seeds, num_snapshots, truncation_psi
  ):
      print('Loading networks from "%s"...' % network_pkl)
      _G, _D, Gs = pretrained_networks.load_networks(network_pkl)
      proj = projector.Projector()
      proj.set_network(Gs)
      noise_vars = [
          var
          for name, var in Gs.components.synthesis.vars.items()
          if name.startswith("noise")
      ]
  
      Gs_kwargs = dnnlib.EasyDict()
      Gs_kwargs.randomize_noise = False
      Gs_kwargs.truncation_psi = truncation_psi
  
      for seed_idx, seed in enumerate(seeds):
          print(
              "Projecting seed %d (%d/%d) ..."
              % (seed, seed_idx, len(seeds))
          )
          rnd = np.random.RandomState(seed)
          z = rnd.randn(1, *Gs.input_shape[1:])
          tflib.set_vars(
              {
                  var: rnd.randn(*var.shape.as_list())
                  for var in noise_vars
              }
          )
          images = Gs.run(z, None, **Gs_kwargs)
          project_image(
              proj,
              targets=images,
              png_prefix=dnnlib.make_run_dir_path("seed%04d-" % seed),
              num_snapshots=num_snapshots,
          )
  
file_path: insightface/reconstruction/ostec/external/stylegan2/run_projector.py
imports: import argparse
  import numpy
  import dnnlib
  import dnnlib.tflib
  import re
  import sys
  import projector
  import pretrained_networks
  from training import dataset
  from training import misc
label_desc: Use image node_id 2 for calling a global function with example usage: project_generated_images(network_pkl, seeds, num_snapshots, truncation_psi) without return types