parameters: (self, detections, res_file)
docstring: example results
          [{"image_id": 42,
            "category_id": 18,
            "bbox": [258.15,41.29,348.26,243.78],
            "score": 0.236}, ...]
docstring_summary: example results
          [{"image_id": 42,
            "category_id": 18,
            "bbox": [258.15,41.29,348.26,243.78],
            "score": 0.236}, ...]
docstring_tokens: example results [ { image_id : 42 category_id : 18 bbox : [ 258 . 15 41 . 29 348 . 26 243 . 78 ] score : 0 . 236 } ... ]
function: def _write_coco_results(self, detections, res_file):
          """ example results
          [{"image_id": 42,
            "category_id": 18,
            "bbox": [258.15,41.29,348.26,243.78],
            "score": 0.236}, ...]
          """
          results = []
          for cls_ind, cls in enumerate(self.classes):
              if cls == '__background__':
                  continue
              logger.info('collecting %s results (%d/%d)' % (cls, cls_ind, self.num_classes - 1))
              coco_cat_id = self._class_to_coco_ind[cls]
              results.extend(self._coco_results_one_category(detections[cls_ind], coco_cat_id))
          logger.info('writing results json to %s' % res_file)
          with open(res_file, 'w') as f:
              json.dump(results, f, sort_keys=True, indent=4)
function_tokens: def _write_coco_results ( self , detections , res_file ) : results = [ ] for cls_ind , cls in enumerate ( self . classes ) : if cls == '__background__' : continue logger . info ( 'collecting %s results (%d/%d)' % ( cls , cls_ind , self . num_classes - 1 ) ) coco_cat_id = self . _class_to_coco_ind [ cls ] results . extend ( self . _coco_results_one_category ( detections [ cls_ind ] , coco_cat_id ) ) logger . info ( 'writing results json to %s' % res_file ) with open ( res_file , 'w' ) as f : json . dump ( results , f , sort_keys = True , indent = 4 )