iou.js 492 B

12345678910
  1. export function iou(box1, box2, isIOU) {
  2. if (isIOU === void 0) { isIOU = true; }
  3. var width = Math.max(0.0, Math.min(box1.right, box2.right) - Math.max(box1.left, box2.left));
  4. var height = Math.max(0.0, Math.min(box1.bottom, box2.bottom) - Math.max(box1.top, box2.top));
  5. var interSection = width * height;
  6. return isIOU
  7. ? interSection / (box1.area + box2.area - interSection)
  8. : interSection / Math.min(box1.area, box2.area);
  9. }
  10. //# sourceMappingURL=iou.js.map