| 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] |