code: def main():
      init_args, call_args = parse_args()
  
      cfg = Config.fromfile(init_args["model"])
      task = cfg.model.head.task
      assert task in TASKINFOS
  
      inferencer = TASKINFOS[task](**init_args)
  
      if task != "caption":
          assert (
              call_args["texts"] is not None
          ), f"text prompts is required for {task}"
          if task != "panoptic":
              call_args.pop("stuff_texts")
      else:
          call_args.pop("texts")
          call_args.pop("stuff_texts")
  
      inferencer(**call_args)
  
      if call_args["out_dir"] != "" and not call_args["no_save_vis"]:
          print_log(
              f'results have been saved at {call_args["out_dir"]}'
          )
  
imports: from argparse import ArgumentParser
  from mmengine.config import Config
  from mmengine.logging import print_log
  from mmdet.apis import DetInferencer
  from projects.XDecoder.xdecoder.inference import ImageCaptionInferencer, RefImageCaptionInferencer, TextToImageRegionRetrievalInferencer
label_desc: Use image node_id 2 for calling a global function with example usage: main() without return types