MCPcopy Create free account
hub / github.com/Tencent/ObjectDetection-OneStageDet / ioa

Function ioa

brambox/boxes/statistics/util.py:31–60  ·  view source on GitHub ↗

Compute the intersection over area between two boxes a and b. The function returns the ``IOA``, which is defined as: :math:`IOA = \\frac { {intersection}(a, b) } { {area}(denominator) }` Args: a (brambox.boxes.box.Box): First bounding box b (brambox.boxes.box.Box): Sec

(a, b, denominator='b')

Source from the content-addressed store, hash-verified

29
30
31def ioa(a, b, denominator='b'):
32 """ Compute the intersection over area between two boxes a and b.
33 The function returns the ``IOA``, which is defined as:
34
35 :math:`IOA = \\frac { {intersection}(a, b) } { {area}(denominator) }`
36
37 Args:
38 a (brambox.boxes.box.Box): First bounding box
39 b (brambox.boxes.box.Box): Second bounding box
40 denominator (string, optional): String indicating from which box to compute the area; Default **'b'**
41
42 Returns:
43 Number: Intersection over union
44
45 Note:
46 The `denominator` can be one of 4 different values.
47 If the parameter is equal to **'a'** or **'b'**, the area of that box will be used as the denominator.
48 If the parameter is equal to **'min'**, the smallest of both boxes will be used
49 and if it is equal to **'max'**, the biggest box will be used.
50 """
51 if denominator == 'min':
52 div = min(a.width * a.height, b.width * b.height)
53 elif denominator == 'max':
54 div = max(a.width * a.height, b.width * b.height)
55 elif denominator == 'a':
56 div = a.width * a.height
57 else:
58 div = b.width * b.height
59
60 return intersection(a, b) / div
61
62
63def match_detections(detection_results, ground_truth, overlap_threshold, overlap_fn=iou):

Callers

nothing calls this directly

Calls 1

intersectionFunction · 0.85

Tested by

no test coverage detected