code: def main(args):
      cfg = setup(args)
  
      if args.eval_only:
          model = Trainer.build_model(cfg)
          DetectionCheckpointer(
              model, save_dir=cfg.OUTPUT_DIR
          ).resume_or_load(cfg.MODEL.WEIGHTS, resume=args.resume)
          res = Trainer.test(cfg, model)
          if comm.is_main_process():
              verify_results(cfg, res)
          return res
  
      trainer = Trainer(cfg)
      trainer.resume_or_load(resume=args.resume)
      return trainer.train()
  
file_path: detectron2/projects/TensorMask/train_net.py
imports: import os
  import detectron2.utils.comm
  from detectron2.checkpoint import DetectionCheckpointer
  from detectron2.config import get_cfg
  from detectron2.engine import DefaultTrainer, default_argument_parser, default_setup, launch
  from detectron2.evaluation import COCOEvaluator, verify_results
  from tensormask import add_tensormask_config
label_desc: Use image node_id 2 for calling a global function with example usage: main(args) and returns: trainer, res