Example #1
0
 def evaluate(self):
     try:
         cocoDt = self.cocoGt.loadRes(self.coco_results)
     except:
         print("no boxes detected, coco eval aborted")
         return 1
     cocoEval = COCOeval(self.cocoGt, cocoDt, "bbox")
     cocoEval.params.imgIds = list(self.coco_imgIds)
     cocoEval.evaluate()
     cocoEval.accumulate()
     cocoEval.summarize()
     return cocoEval.stats
Example #2
0
    def _do_python_eval(self, res_file, res_folder, ann_type):
        print 'do python eval'
        coco_dt = self.coco.loadRes(res_file)
        #print('>>>> do python eval resfile {}'.format(res_file))
        coco_eval = COCOeval(self.coco, coco_dt)
        coco_eval.params.useSegm = (ann_type == 'segm')
        coco_eval.evaluate()
        coco_eval.accumulate()
        info_str = self._print_detection_metrics(coco_eval)

        eval_file = os.path.join(res_folder,
                                 'detections_%s_results.pkl' % self.image_set)
        with open(eval_file, 'w') as f:
            cPickle.dump(coco_eval, f, cPickle.HIGHEST_PROTOCOL)
        print 'coco eval results saved to %s' % eval_file
        info_str += 'coco eval results saved to %s\n' % eval_file
        return info_str