code: def main():
      parser = argparse.ArgumentParser(
          description="""StyleGAN2 projector.
  
  Run 'python %(prog)s <subcommand> --help' for subcommand help.""",
          epilog=_examples,
          formatter_class=argparse.RawDescriptionHelpFormatter,
      )
  
      subparsers = parser.add_subparsers(
          help="Sub-commands", dest="command"
      )
  
      project_generated_images_parser = subparsers.add_parser(
          "project-generated-images", help="Project generated images"
      )
      project_generated_images_parser.add_argument(
          "--network",
          help="Network pickle filename",
          dest="network_pkl",
          required=True,
      )
      project_generated_images_parser.add_argument(
          "--seeds",
          type=_parse_num_range,
          help="List of random seeds",
          default=range(3),
      )
      project_generated_images_parser.add_argument(
          "--num-snapshots",
          type=int,
          help="Number of snapshots (default: %(default)s)",
          default=5,
      )
      project_generated_images_parser.add_argument(
          "--truncation-psi",
          type=float,
          help="Truncation psi (default: %(default)s)",
          default=1.0,
      )
      project_generated_images_parser.add_argument(
          "--result-dir",
          help="Root directory for run results (default: %(default)s)",
          default="results",
          metavar="DIR",
      )
  
      project_real_images_parser = subparsers.add_parser(
          "project-real-images", help="Project real images"
      )
      project_real_images_parser.add_argument(
          "--network",
          help="Network pickle filename",
          dest="network_pkl",
          required=True,
      )
      project_real_images_parser.add_argument(
          "--data-dir", help="Dataset root directory", required=True
      )
      project_real_images_parser.add_argument(
          "--dataset",
          help="Training dataset",
          dest="dataset_name",
          required=True,
      )
      project_real_images_parser.add_argument(
          "--num-snapshots",
          type=int,
          help="Number of snapshots (default: %(default)s)",
          default=5,
      )
      project_real_images_parser.add_argument(
          "--num-images",
          type=int,
          help="Number of images to project (default: %(default)s)",
          default=3,
      )
      project_real_images_parser.add_argument(
          "--result-dir",
          help="Root directory for run results (default: %(default)s)",
          default="results",
          metavar="DIR",
      )
  
      args = parser.parse_args()
      subcmd = args.command
      if subcmd is None:
          print(
              "Error: missing subcommand.  Re-run with --help for usage."
          )
          sys.exit(1)
  
      kwargs = vars(args)
      sc = dnnlib.SubmitConfig()
      sc.num_gpus = 1
      sc.submit_target = dnnlib.SubmitTarget.LOCAL
      sc.local.do_not_copy_source_files = True
      sc.run_dir_root = kwargs.pop("result_dir")
      sc.run_desc = kwargs.pop("command")
  
      func_name_map = {
          "project-generated-images": "run_projector.project_generated_images",
          "project-real-images": "run_projector.project_real_images",
      }
      dnnlib.submit_run(sc, func_name_map[subcmd], **kwargs)
  
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 5 for calling a global function with example usage: main() without return types