code: def do_test(cfg, model):
      results = OrderedDict()
      for dataset_name in cfg.DATASETS.TEST:
          data_loader = build_detection_test_loader(cfg, dataset_name)
          evaluator = get_evaluator(
              cfg,
              dataset_name,
              os.path.join(cfg.OUTPUT_DIR, "inference", dataset_name),
          )
          results_i = inference_on_dataset(
              model, data_loader, evaluator
          )
          results[dataset_name] = results_i
          if comm.is_main_process():
              logger.info(
                  "Evaluation results for {} in csv format:".format(
                      dataset_name
                  )
              )
              print_csv_format(results_i)
      if len(results) == 1:
          results = list(results.values())[0]
      return results
  
file_path: detectron2/tools/plain_train_net.py
imports: import logging
  import os
  from collections import OrderedDict
  import torch
  from torch.nn.parallel import DistributedDataParallel
  import detectron2.utils.comm
  from detectron2.checkpoint import DetectionCheckpointer, PeriodicCheckpointer
  from detectron2.config import get_cfg
  from detectron2.data import MetadataCatalog, build_detection_test_loader, build_detection_train_loader
  from detectron2.engine import default_argument_parser, default_setup, default_writers, launch
  from detectron2.evaluation import CityscapesInstanceEvaluator, CityscapesSemSegEvaluator, COCOEvaluator, COCOPanopticEvaluator, DatasetEvaluators, LVISEvaluator, PascalVOCDetectionEvaluator, SemSegEvaluator, inference_on_dataset, print_csv_format
  from detectron2.modeling import build_model
  from detectron2.solver import build_lr_scheduler, build_optimizer
  from detectron2.utils.events import EventStorage
label_desc: Use image node_id 2 for calling a global function with example usage: do_test(cfg, model) and returns: results