code: def default_argument_parser(epilog=None):
      """
      Create a parser with some common arguments used by detectron2 users.
  
      Args:
          epilog (str): epilog passed to ArgumentParser describing the usage.
  
      Returns:
          argparse.ArgumentParser:
      """
      parser = argparse.ArgumentParser(
          epilog=epilog
          or f"""
  Examples:
  
  Run on single machine:
      $ {sys.argv[0]} --num-gpus 8 --config-file cfg.yaml
  
  Change some config options:
      $ {sys.argv[0]} --config-file cfg.yaml MODEL.WEIGHTS /path/to/weight.pth SOLVER.BASE_LR 0.001
  
  Run on multiple machines:
      (machine0)$ {sys.argv[0]} --machine-rank 0 --num-machines 2 --dist-url <URL> [--other-flags]
      (machine1)$ {sys.argv[0]} --machine-rank 1 --num-machines 2 --dist-url <URL> [--other-flags]
  """,
          formatter_class=argparse.RawDescriptionHelpFormatter,
      )
      parser.add_argument(
          "--config-file",
          default="",
          metavar="FILE",
          help="path to config file",
      )
      parser.add_argument(
          "--resume",
          action="store_true",
          help="Whether to attempt to resume from the checkpoint directory. "
          "See documentation of `DefaultTrainer.resume_or_load()` for what it means.",
      )
      parser.add_argument(
          "--eval-only",
          action="store_true",
          help="perform evaluation only",
      )
      parser.add_argument(
          "--num-gpus",
          type=int,
          default=1,
          help="number of gpus *per machine*",
      )
      parser.add_argument(
          "--num-machines",
          type=int,
          default=1,
          help="total number of machines",
      )
      parser.add_argument(
          "--machine-rank",
          type=int,
          default=0,
          help="the rank of this machine (unique per machine)",
      )
  
      # PyTorch still may leave orphan processes in multi-gpu training.
      # Therefore we use a deterministic way to obtain port,
      # so that users are aware of orphan processes by seeing the port occupied.
      port = (
          2**15
          + 2**14
          + hash(os.getuid() if sys.platform != "win32" else 1)
          % 2**14
      )
      parser.add_argument(
          "--dist-url",
          default="tcp://127.0.0.1:{}".format(port),
          help="initialization URL for pytorch distributed backend. See "
          "https://pytorch.org/docs/stable/distributed.html for details.",
      )
      parser.add_argument(
          "opts",
          help="""
  Modify config options at the end of the command. For Yacs configs, use
  space-separated "PATH.KEY VALUE" pairs.
  For python-based LazyConfig, use "path.key=value".
          """.strip(),
          default=None,
          nargs=argparse.REMAINDER,
      )
      return parser
  
imports: import argparse
  import logging
  import os
  import sys
  import weakref
  from collections import OrderedDict
  from typing import Optional
  import torch
  from fvcore.nn.precise_bn import get_bn_modules
  from omegaconf import OmegaConf
  from torch.nn.parallel import DistributedDataParallel
  import detectron2.data.transforms
  from detectron2.checkpoint import DetectionCheckpointer
  from detectron2.config import CfgNode, LazyConfig
  from detectron2.data import MetadataCatalog, build_detection_test_loader, build_detection_train_loader
  from detectron2.evaluation import DatasetEvaluator, inference_on_dataset, print_csv_format, verify_results
  from detectron2.modeling import build_model
  from detectron2.solver import build_lr_scheduler, build_optimizer
  from detectron2.utils import comm
  from detectron2.utils.collect_env import collect_env_info
  from detectron2.utils.env import seed_all_rng
  from detectron2.utils.events import CommonMetricPrinter, JSONWriter, TensorboardXWriter
  from detectron2.utils.file_io import PathManager
  from detectron2.utils.logger import setup_logger
  from .None import hooks
  from .train_loop import AMPTrainer, SimpleTrainer, TrainerBase
label_desc: Use image node_id 2 for calling a global function with example usage: default_argument_parser(epilog) and returns: parser