docstr: Convert detection results to COCO json style.
docstr_tok: ["Convert","detection","results","to","COCO","json","style","."]
code: def _det2json(self, results):
      """Convert detection results to COCO json style."""
      json_results = []
      for idx in range(len(self)):
          img_id = self.img_ids[idx]
          result = results[idx]
          for label in range(len(result)):
              bboxes = result[label]
              for i in range(bboxes.shape[0]):
                  data = dict()
                  data["image_id"] = img_id
                  data["bbox"] = self.xyxy2xywh(bboxes[i])
                  data["score"] = float(bboxes[i][4])
                  data["category_id"] = self.cat_ids[label]
                  json_results.append(data)
      return json_results
  
imports: import itertools
  import logging
  import os.path
  import tempfile
  from collections import OrderedDict
  import mmcv
  import numpy
  from mmcv.utils import print_log
  from pycocotools.coco import COCO
  from pycocotools.cocoeval import COCOeval
  from terminaltables import AsciiTable
  from mmdet.core import eval_recalls
  from .builder import DATASETS
  from .custom import CustomDataset
label_desc: Use image node_id 8 for calling the CocoDataset obj's underlying member method code with example usage: obj._det2json(results) and returns: json_results