Skip to content

Commit 8ec8180

Browse files
committed
Fix voting to ignore excess bins.
1 parent c588d01 commit 8ec8180

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

__init__.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,9 @@ def votes_to_detections(locations, probas=None, in_rphi=True, out_rphi=True, bin
171171
172172
Returns a list of tuples (x,y,class) or (r,phi,class) where `class` is
173173
the index into `probas` which was highest for each detection, thus starts at 0.
174+
175+
NOTE/TODO: We really should replace `bin_size` by `nbins` so as to avoid "remainders".
176+
Right now, we simply ignore the remainder on the "max" side.
174177
'''
175178
locations = np.array(locations)
176179
if len(locations) == 0:
@@ -186,6 +189,11 @@ def votes_to_detections(locations, probas=None, in_rphi=True, out_rphi=True, bin
186189
y_range = int((y_max-y_min)/bin_size)
187190
grid = np.zeros((x_range, y_range, 1+probas.shape[1]), np.float32)
188191

192+
# Update x/y max to correspond to the end of the last bin.
193+
# TODO: fix this as stated in the docstring.
194+
x_max = x_min + x_range*bin_size
195+
y_max = y_min + y_range*bin_size
196+
189197
# Do the voting into the grid.
190198
for loc, p in zip(locations, probas):
191199
x,y = rphi_to_xy(*loc) if in_rphi else loc

0 commit comments

Comments
 (0)