MCPcopy Create free account
hub / github.com/OpenGVLab/HumanBench / compare_caltech

Method compare_caltech

PATH/core/solvers/utils/peddet_tester_dev.py:253–284  ·  view source on GitHub ↗

:meth: match the detection results with the groundtruth by Caltech matching strategy :param thres: iou threshold :type thres: float :return: a list of tuples (dtbox, imageID), in the descending sort of dtbox.score

(self, thres)

Source from the content-addressed store, hash-verified

251 raise Exception('Unknown evaluation mode!')
252
253 def compare_caltech(self, thres):
254 """
255 :meth: match the detection results with the groundtruth by Caltech matching strategy
256 :param thres: iou threshold
257 :type thres: float
258 :return: a list of tuples (dtbox, imageID), in the descending sort of dtbox.score
259 """
260 if self.dtboxes is None or self.gtboxes is None:
261 return list()
262
263 dtboxes = self.dtboxes if self.dtboxes is not None else list()
264 gtboxes = self.gtboxes if self.gtboxes is not None else list()
265
266 dtboxes = np.array(sorted(dtboxes, key=lambda x: x[-1], reverse=True))
267 gtboxes = np.array(sorted(gtboxes, key=lambda x: x[-1], reverse=True))
268 if len(dtboxes) and len(gtboxes):
269 overlap_iou = self.box_overlap_opr(dtboxes, gtboxes[gtboxes[:, -1] > 0], True)
270 overlap_ioa = self.box_overlap_opr(dtboxes, gtboxes[gtboxes[:, -1] <= 0], False)
271 ign = np.any(overlap_ioa > thres, 1)
272 pos = np.any(overlap_iou > thres, 1)
273 else:
274 return list()
275
276 scorelist = list()
277 for i, dt in enumerate(dtboxes):
278 maxpos = np.argmax(overlap_iou[i])
279 if overlap_iou[i, maxpos] > thres:
280 overlap_iou[:, maxpos] = 0
281 scorelist.append((dt, 1, self.ID, pos[i]))
282 elif not ign[i]:
283 scorelist.append((dt, 0, self.ID, pos[i]))
284 return scorelist
285
286 def compare_caltech_union(self, thres):
287 """

Callers 1

compareMethod · 0.80

Calls 1

box_overlap_oprMethod · 0.95

Tested by

no test coverage detected