server-json/node_modules/tfjs-image-recognition-base/build/es6/ops/iou.js
2024-11-01 08:00:42 +00:00

10 lines
No EOL
501 B
JavaScript

export function iou(box1, box2, isIOU) {
if (isIOU === void 0) { isIOU = true; }
var width = Math.max(0.0, Math.min(box1.right, box2.right) - Math.max(box1.left, box2.left));
var height = Math.max(0.0, Math.min(box1.bottom, box2.bottom) - Math.max(box1.top, box2.top));
var interSection = width * height;
return isIOU
? interSection / (box1.area + box2.area - interSection)
: interSection / Math.min(box1.area, box2.area);
}
//# sourceMappingURL=iou.js.map