bluemellophone commited on
Commit
e738121
·
unverified ·
1 Parent(s): 1e46c0a

Add a bit more documentation for AGG

Browse files
Files changed (2) hide show
  1. scoutbot/__init__.py +1 -1
  2. scoutbot/agg/__init__.py +30 -1
scoutbot/__init__.py CHANGED
@@ -56,7 +56,7 @@ log = utils.init_logging()
56
 
57
  from scoutbot import agg, loc, tile, wic # NOQA
58
 
59
- VERSION = '0.1.9'
60
  version = VERSION
61
  __version__ = VERSION
62
 
 
56
 
57
  from scoutbot import agg, loc, tile, wic # NOQA
58
 
59
+ VERSION = '0.1.10'
60
  version = VERSION
61
  __version__ = VERSION
62
 
scoutbot/agg/__init__.py CHANGED
@@ -19,6 +19,35 @@ NMS_THRESH = 0.2
19
  def iou(box1, box2):
20
  """
21
  Computes the IoU (Intersection over Union) ratio for two bounding boxes.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
22
  """
23
  inter_xtl = max(box1['xtl'], box2['xtl'])
24
  inter_ytl = max(box1['ytl'], box2['ytl'])
@@ -139,7 +168,7 @@ def compute(
139
  img_shape, tile_grids, loc_outputs, agg_thresh=AGG_THRESH, nms_thresh=NMS_THRESH
140
  ):
141
  """
142
- Compute the aggregated image-level detection results for a given list of tile-level detections
143
  """
144
  from scoutbot.agg.py_cpu_nms import py_cpu_nms
145
 
 
19
  def iou(box1, box2):
20
  """
21
  Computes the IoU (Intersection over Union) ratio for two bounding boxes.
22
+
23
+ Each box dictionary must have a structure with the following keys:
24
+
25
+ ::
26
+
27
+ {
28
+ 'xtl': x_top_left (int)
29
+ 'ytl': y_top_left (int)
30
+ 'xbr': x_bottom_right (int)
31
+ 'ybr': y_bottom_right (int)
32
+ }
33
+
34
+ The ``(xtl, ytl)`` coordinate is the top-left corner of the box.
35
+
36
+ The ``(xbr, ybr)`` coordinate is the opposite bottom-right corner of the box.
37
+
38
+ The order of the boxes does not impact the calculation of the intersection
39
+ and union values.
40
+
41
+ Args:
42
+ box1 (dict): a dictionary of the first bounding box's dimensions
43
+ box2 (dict): a dictionary of the second bounding box's dimensions
44
+
45
+ Returns:
46
+ tuple ( int, int, int, int ):
47
+ - the pixel area of the first box
48
+ - the pixel area of the second box
49
+ - the pixel area of the intersection (overlapping area) between the boxes
50
+ - the pixel area of the union (combined area) between the boxes
51
  """
52
  inter_xtl = max(box1['xtl'], box2['xtl'])
53
  inter_ytl = max(box1['ytl'], box2['ytl'])
 
168
  img_shape, tile_grids, loc_outputs, agg_thresh=AGG_THRESH, nms_thresh=NMS_THRESH
169
  ):
170
  """
171
+ Compute the aggregated image-level detection results for a given list of tile-level detections.
172
  """
173
  from scoutbot.agg.py_cpu_nms import py_cpu_nms
174