code: def eval_inference_results(self, results, output=None):
      continuous_id_to_COCO_id = {
          v: k for k, v in self.COCO_id_to_category_id.items()
      }
      for res in results:
          # convert to COCO's incontinuous category id
          if res["category_id"] in continuous_id_to_COCO_id:
              res["category_id"] = continuous_id_to_COCO_id[
                  res["category_id"]
              ]
          # COCO expects results in xywh format
          box = res["bbox"]
          box[2] -= box[0]
          box[3] -= box[1]
          res["bbox"] = [round(float(x), 3) for x in box]
  
      if output is not None:
          with open(output, "w") as f:
              json.dump(results, f)
      if len(results):
          # sometimes may crash if the results are empty?
          return self.print_coco_metrics(results)
      else:
          return {}
  
file_path: tensorpack/examples/FasterRCNN/dataset/coco.py
imports: import json
  import numpy
  import os
  import tqdm
  from tensorpack.utils import logger
  from tensorpack.utils.timer import timed_operation
  from config import config
  from dataset import DatasetRegistry, DatasetSplit
label_desc: Use image node_id 7 for calling the COCODetection obj's underlying member method code with example usage: obj.eval_inference_results(results, output) and returns: self, dict