Run per image evaluation on given images and store results (a list of dict) in self.evalImgs :return: None
(self)
| 125 | self.eval = {} # accumulated evaluation results |
| 126 | |
| 127 | def evaluate(self): |
| 128 | ''' |
| 129 | Run per image evaluation on given images and store results (a list of dict) in self.evalImgs |
| 130 | :return: None |
| 131 | ''' |
| 132 | tic = time.time() |
| 133 | print('Running per image evaluation...') |
| 134 | p = self.params |
| 135 | print('Evaluate annotation type *{}*'.format(p.iouType)) |
| 136 | p.imgIds = list(np.unique(p.imgIds)) |
| 137 | p.maxDets = sorted(p.maxDets) |
| 138 | self.params=p |
| 139 | # print(self._gts, "GTTSSDFJDSL2") |
| 140 | |
| 141 | self._prepare() |
| 142 | # loop through images, area range, max detection number |
| 143 | catIds = p.catIds if p.useCats else [-1] |
| 144 | |
| 145 | if p.iouType == 'bbox': |
| 146 | computeIoU = self.computeIoU |
| 147 | else: |
| 148 | print("iouType not supported.") |
| 149 | self.ious = {imgId: computeIoU(imgId) \ |
| 150 | for imgId in p.imgIds} |
| 151 | |
| 152 | evaluateImg = self.evaluateImg |
| 153 | maxDet = p.maxDets[-1] |
| 154 | self.evalImgs = [evaluateImg(imgId, areaRng, maxDet) |
| 155 | for areaRng in p.areaRng |
| 156 | for imgId in p.imgIds |
| 157 | ] |
| 158 | self._paramsEval = copy.deepcopy(self.params) |
| 159 | toc = time.time() |
| 160 | print('DONE (t={:0.2f}s).'.format(toc-tic)) |
| 161 | |
| 162 | def computeIoU(self, imgId): |
| 163 | p = self.params |