MCPcopy Create free account
hub / github.com/Francis-Rings/FlashPortrait / count_iou

Method count_iou

wan/models/face_model.py:478–500  ·  view source on GitHub ↗
(self, boxA, boxB)

Source from the content-addressed store, hash-verified

476 return self.trackingFaces
477
478 def count_iou(self, boxA, boxB):
479 # determine the (x, y)-coordinates of the intersection rectangle
480 xA = max(boxA[0], boxB[0])
481 yA = max(boxA[1], boxB[1])
482 xB = min(boxA[2], boxB[2])
483 yB = min(boxA[3], boxB[3])
484
485 # compute the area of intersection rectangle
486 interArea = abs(max((xB - xA, 0)) * max((yB - yA), 0))
487 if interArea == 0:
488 return 0
489 # compute the area of both the prediction and ground-truth
490 # rectangles
491 boxAArea = abs((boxA[2] - boxA[0]) * (boxA[3] - boxA[1]))
492 boxBArea = abs((boxB[2] - boxB[0]) * (boxB[3] - boxB[1]))
493
494 # compute the intersection over union by taking the intersection
495 # area and dividing it by the sum of prediction + ground-truth
496 # areas - the interesection area
497 iou = interArea / float(boxAArea + boxBArea - interArea)
498
499 # return the intersection over union value
500 return iou
501
502 def area(self, bbox):
503 w = bbox[3] - bbox[1]

Callers 1

forwardMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected