MCPcopy Create free account
hub / github.com/ChenhongyiYang/QueryDet-PyTorch / _iou

Method _iou

utils/loop_matcher.py:24–34  ·  view source on GitHub ↗
(self, boxes, box)

Source from the content-addressed store, hash-verified

22
23
24 def _iou(self, boxes, box):
25 iw = torch.clamp(boxes[:, 2], max=box[2]) - torch.clamp(boxes[:, 0], min=box[0])
26 ih = torch.clamp(boxes[:, 3], max=box[3]) - torch.clamp(boxes[:, 1], min=box[1])
27
28 inter = torch.clamp(iw, min=0) * torch.clamp(ih, min=0)
29
30 areas = (boxes[:, 2] - boxes[:, 0]) * (boxes[:, 3] - boxes[:, 1])
31 area = (box[2] - box[0]) * (box[3] - box[1])
32
33 iou = inter / (areas + area - inter)
34 return iou
35
36 def __call__(self, gt_boxes, anchors):
37 if len(gt_boxes) == 0:

Callers 1

__call__Method · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected