Compute the intersection over union between two boxes. The function returns the ``IUO``, which is defined as: :math:`IOU = \\frac { {intersection}(a, b) } { {union}(a, b) }` Args: a (brambox.boxes.box.Box): First bounding box b (brambox.boxes.box.Box): Second bounding
(a, b)
| 10 | |
| 11 | |
| 12 | def iou(a, b): |
| 13 | """ Compute the intersection over union between two boxes. |
| 14 | The function returns the ``IUO``, which is defined as: |
| 15 | |
| 16 | :math:`IOU = \\frac { {intersection}(a, b) } { {union}(a, b) }` |
| 17 | |
| 18 | Args: |
| 19 | a (brambox.boxes.box.Box): First bounding box |
| 20 | b (brambox.boxes.box.Box): Second bounding box |
| 21 | |
| 22 | Returns: |
| 23 | Number: Intersection over union |
| 24 | """ |
| 25 | intersection_area = intersection(a, b) |
| 26 | union_area = a.width * a.height + b.width * b.height - intersection_area |
| 27 | |
| 28 | return intersection_area / union_area |
| 29 | |
| 30 | |
| 31 | def ioa(a, b, denominator='b'): |
nothing calls this directly
no test coverage detected