MCPcopy Create free account
hub / github.com/OpenDriveLab/OpenLane / computeIoU

Method computeIoU

eval/CIPO_evaluation/pycocotools/cocoeval.py:162–186  ·  view source on GitHub ↗
(self, imgId)

Source from the content-addressed store, hash-verified

160 print('DONE (t={:0.2f}s).'.format(toc-tic))
161
162 def computeIoU(self, imgId):
163 p = self.params
164 if p.useCats:
165 gt = self._gts[imgId]
166 dt = self._dts[imgId]
167 else:
168 gt = [_ for _ in self._gts[imgId]]
169 dt = [_ for _ in self._dts[imgId]]
170 if len(gt) == 0 and len(dt) ==0:
171 return []
172 inds = np.argsort([-d['score'] for d in dt], kind='mergesort')
173 dt = [dt[i] for i in inds]
174 if len(dt) > p.maxDets[-1]:
175 dt=dt[0:p.maxDets[-1]]
176
177 if p.iouType == 'bbox':
178 g = [g['bbox'] for g in gt]
179 d = [d['bbox'] for d in dt]
180 else:
181 raise Exception('unknown iouType for iou computation')
182
183 # compute iou between each dt and gt region
184 iscrowd = [int(o['iscrowd']) for o in gt]
185 ious = maskUtils.iou(d,g,iscrowd)
186 return ious
187
188 def computeOks(self, imgId, catId):
189 p = self.params

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected