Accumulate per image evaluation results and store the result in self.eval. Does not support changing parameter settings from those used by self.evaluate()
(self)
| 95 | # >>>> End of code differences with original COCO API |
| 96 | |
| 97 | def accumulate(self): |
| 98 | """ |
| 99 | Accumulate per image evaluation results and store the result in self.eval. Does not |
| 100 | support changing parameter settings from those used by self.evaluate() |
| 101 | """ |
| 102 | print("Accumulating evaluation results...") |
| 103 | tic = time.time() |
| 104 | if not hasattr(self, "_evalImgs_cpp"): |
| 105 | print("Please run evaluate() first") |
| 106 | |
| 107 | self.eval = _C.COCOevalAccumulate(self._paramsEval, self._evalImgs_cpp) |
| 108 | |
| 109 | # recall is num_iou_thresholds X num_categories X num_area_ranges X num_max_detections |
| 110 | self.eval["recall"] = np.array(self.eval["recall"]).reshape( |
| 111 | self.eval["counts"][:1] + self.eval["counts"][2:] |
| 112 | ) |
| 113 | |
| 114 | # precision and scores are num_iou_thresholds X num_recall_thresholds X num_categories X |
| 115 | # num_area_ranges X num_max_detections |
| 116 | self.eval["precision"] = np.array(self.eval["precision"]).reshape(self.eval["counts"]) |
| 117 | self.eval["scores"] = np.array(self.eval["scores"]).reshape(self.eval["counts"]) |
| 118 | toc = time.time() |
| 119 | print("COCOeval_opt.accumulate() finished in {:0.2f} seconds.".format(toc - tic)) |