docstr: Dump the detection results to a COCO style json file.
  
  There are 3 types of results: proposals, bbox predictions, mask
  predictions, and they have different data types. This method will
  automatically recognize the type, and dump them to json files.
  
  Args:
      results (Sequence[dict]): Testing results of the
          dataset.
  
  Returns:
      dict: Possible keys are "bbox", "segm", "proposal", and
      values are corresponding filenames.
docstr_tok: ["Dump","the","detection","results","to","a","COCO","style","json","file",".","There","are","3","types","of","results",":","proposals",",","bbox","predictions",",","mask","predictions",",","and","they","have","different","data","types",".","This","method","will","automatically","recognize","the","type",",","and","dump","them","to","json","files",".","Args",":","results","(","Sequence","[","dict","]",")",":","Testing","results","of","the","dataset",".","Returns",":","dict",":","Possible","keys","are","``","bbox","''",",","``","segm","''",",","``","proposal","''",",","and","values","are","corresponding","filenames","."]
code: def results2json(self, results: Sequence[dict]) -> list:
      """Dump the detection results to a COCO style json file.
  
      There are 3 types of results: proposals, bbox predictions, mask
      predictions, and they have different data types. This method will
      automatically recognize the type, and dump them to json files.
  
      Args:
          results (Sequence[dict]): Testing results of the
              dataset.
  
      Returns:
          dict: Possible keys are "bbox", "segm", "proposal", and
          values are corresponding filenames.
      """
      bbox_json_results = []
      for idx, result in enumerate(results):
          image_id = result.get("img_id", idx)
          labels = result["labels"]
          bboxes = result["bboxes"]
          scores = result["scores"]
          for i, label in enumerate(labels):
              data = dict()
              data["image_id"] = image_id
              data["bbox"] = self.xyxy2xywh(bboxes[i])
              data["score"] = float(scores[i])
              data["category_id"] = label
              bbox_json_results.append(data)
      return bbox_json_results
  
file_path: mmdetection/mmdet/evaluation/metrics/dod_metric.py
imports: from collections import defaultdict
  from typing import List, Optional, Sequence
  import numpy
  from mmengine.evaluator import BaseMetric
  from mmengine.fileio import get_local_path
  from mmengine.logging import MMLogger
  from mmdet.datasets.api_wrappers import COCO, COCOeval
  from mmdet.registry import METRICS
label_desc: Use image node_id 4 for calling the DODCocoMetric obj's underlying member method code with example usage: obj.results2json(results) and returns: bbox_json_results