bluemellophone commited on
Commit
d9a1247
·
unverified ·
1 Parent(s): aea0a3d

Overview strings

Browse files
scoutbot/agg/__init__.py CHANGED
@@ -1,7 +1,11 @@
1
  # -*- coding: utf-8 -*-
2
- '''
3
- 2022 Wild Me
4
- '''
 
 
 
 
5
  import numpy as np
6
  import utool as ut
7
 
@@ -11,6 +15,9 @@ NMS_THRESH = 0.2
11
 
12
 
13
  def iou(box1, box2):
 
 
 
14
  inter_xtl = max(box1['xtl'], box2['xtl'])
15
  inter_ytl = max(box1['ytl'], box2['ytl'])
16
  inter_xbr = min(box1['xbr'], box2['xbr'])
@@ -35,6 +42,10 @@ def iou(box1, box2):
35
 
36
 
37
  def demosaic(img_shape, tile_grids, loc_outputs, margin=MARGIN):
 
 
 
 
38
  assert len(tile_grids) == len(loc_outputs)
39
 
40
  img_h, img_w = img_shape[:2]
@@ -125,6 +136,9 @@ def demosaic(img_shape, tile_grids, loc_outputs, margin=MARGIN):
125
  def compute(
126
  img_shape, tile_grids, loc_outputs, agg_thresh=AGG_THRESH, nms_thresh=NMS_THRESH
127
  ):
 
 
 
128
  from scoutbot.agg.py_cpu_nms import py_cpu_nms
129
 
130
  # Demosaic tile detection results and aggregate across the image
 
1
  # -*- coding: utf-8 -*-
2
+ """Aggregation (AGG) returns unified detects for an image given its individual tile detections
3
+
4
+ This module defines how the tile-base localization detection results are aggregated
5
+ at the image level. This includes the ability to weight the importance of detections
6
+ along the border of each tile within an image, and performing non-maximum suppression (NMS)
7
+ on the combined results.
8
+ """
9
  import numpy as np
10
  import utool as ut
11
 
 
15
 
16
 
17
  def iou(box1, box2):
18
+ """
19
+ Computes the IoU (Intersection over Union) ratio for two bounding boxes.
20
+ """
21
  inter_xtl = max(box1['xtl'], box2['xtl'])
22
  inter_ytl = max(box1['ytl'], box2['ytl'])
23
  inter_xbr = min(box1['xbr'], box2['xbr'])
 
42
 
43
 
44
  def demosaic(img_shape, tile_grids, loc_outputs, margin=MARGIN):
45
+ """
46
+ Demosaics a list of tiles and their respective detections back into the original
47
+ image's coordinate system.
48
+ """
49
  assert len(tile_grids) == len(loc_outputs)
50
 
51
  img_h, img_w = img_shape[:2]
 
136
  def compute(
137
  img_shape, tile_grids, loc_outputs, agg_thresh=AGG_THRESH, nms_thresh=NMS_THRESH
138
  ):
139
+ """
140
+ Compute the aggregated image-level detection results for a given list of tile-level detections
141
+ """
142
  from scoutbot.agg.py_cpu_nms import py_cpu_nms
143
 
144
  # Demosaic tile detection results and aggregate across the image
scoutbot/loc/__init__.py CHANGED
@@ -1,6 +1,11 @@
1
  # -*- coding: utf-8 -*-
2
- '''
3
- The localizer (loc) is responsible for taking a (256, 256) tile image
 
 
 
 
 
4
  '''
5
  from os.path import exists, join
6
  from pathlib import Path
 
1
  # -*- coding: utf-8 -*-
2
+ '''The localizer (LOC) returns bounding box detections on image tiles.
3
+
4
+ This module defines how Localizer models are downloaded from an external CDN,
5
+ how to load an image and prepare it for inference, demonstrates how to run the
6
+ Localization ONNX model on this input, and finally how to convert this raw CNN
7
+ output into usable detection bounding boxes with class labels and confidence
8
+ scores.
9
  '''
10
  from os.path import exists, join
11
  from pathlib import Path
scoutbot/scoutbot.py CHANGED
@@ -1,7 +1,7 @@
1
  #!/usr/bin/env python
2
  # -*- coding: utf-8 -*-
3
  """
4
- ScoutBot CLI executable
5
  """
6
  import click
7
 
 
1
  #!/usr/bin/env python
2
  # -*- coding: utf-8 -*-
3
  """
4
+ Coming Soon
5
  """
6
  import click
7
 
scoutbot/tile/__init__.py CHANGED
@@ -1,6 +1,6 @@
1
  # -*- coding: utf-8 -*-
2
  '''
3
- 2022 Wild Me
4
  '''
5
  from os.path import abspath, exists, join, split, splitext
6
 
@@ -66,6 +66,10 @@ def tile_write(img, grid, filepath):
66
 
67
 
68
  def tile_filepath(img_filepath, grid, ext=None):
 
 
 
 
69
  x = grid.get('x')
70
  y = grid.get('y')
71
  w = grid.get('w')
@@ -86,6 +90,9 @@ def tile_filepath(img_filepath, grid, ext=None):
86
  def tile_grid(
87
  shape, size=TILE_SIZE, overlap=TILE_OVERLAP, offset=TILE_OFFSET, borders=TILE_BORDERS
88
  ):
 
 
 
89
  h_, w_ = shape[:2]
90
  w, h = size
91
  ol = overlap
 
1
  # -*- coding: utf-8 -*-
2
  '''
3
+
4
  '''
5
  from os.path import abspath, exists, join, split, splitext
6
 
 
66
 
67
 
68
  def tile_filepath(img_filepath, grid, ext=None):
69
+ """
70
+ Returns a suggested filepath for a tile given the original image filepath and the tile's grid
71
+ coordinates.
72
+ """
73
  x = grid.get('x')
74
  y = grid.get('y')
75
  w = grid.get('w')
 
90
  def tile_grid(
91
  shape, size=TILE_SIZE, overlap=TILE_OVERLAP, offset=TILE_OFFSET, borders=TILE_BORDERS
92
  ):
93
+ """
94
+ Calculates a grid of tile coordinates for a given image.
95
+ """
96
  h_, w_ = shape[:2]
97
  w, h = size
98
  ol = overlap
scoutbot/utils.py CHANGED
@@ -1,6 +1,6 @@
1
  # -*- coding: utf-8 -*-
2
  '''
3
- 2022 Wild Me
4
  '''
5
  import logging
6
  from logging.handlers import TimedRotatingFileHandler
 
1
  # -*- coding: utf-8 -*-
2
  '''
3
+ Scoutbot utilities file for common and handy functions.
4
  '''
5
  import logging
6
  from logging.handlers import TimedRotatingFileHandler