Skip to content

Commit

Permalink
clean up bbox.
Browse files Browse the repository at this point in the history
  • Loading branch information
Xinlei Chen committed Sep 16, 2017
1 parent 85a4559 commit 1132e83
Showing 1 changed file with 0 additions and 37 deletions.
37 changes: 0 additions & 37 deletions lib/utils/bbox.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -54,40 +54,3 @@ def bbox_overlaps(
overlaps[n, k] = iw * ih / ua
return overlaps

def bbox_overlaps_self(
np.ndarray[DTYPE_t, ndim=2] boxes,
np.ndarray[DTYPE_t, ndim=2] query_boxes):
"""
Parameters
----------
boxes: (N, 4) ndarray of float
query_boxes: (K, 4) ndarray of float
Returns
-------
overlaps: (N, K) ndarray of overlap between boxes and query_boxes
"""
cdef unsigned int N = boxes.shape[0]
cdef unsigned int K = query_boxes.shape[0]
cdef np.ndarray[DTYPE_t, ndim=2] overlaps = np.zeros((N, K), dtype=DTYPE)
cdef DTYPE_t iw, ih, box_area
cdef DTYPE_t ua
cdef unsigned int k, n
for k in range(K):
box_area = (
(query_boxes[k, 2] - query_boxes[k, 0] + 1) *
(query_boxes[k, 3] - query_boxes[k, 1] + 1)
)
for n in range(N):
iw = (
min(boxes[n, 2], query_boxes[k, 2]) -
max(boxes[n, 0], query_boxes[k, 0]) + 1
)
if iw > 0:
ih = (
min(boxes[n, 3], query_boxes[k, 3]) -
max(boxes[n, 1], query_boxes[k, 1]) + 1
)
if ih > 0:
ua = float(box_area)
overlaps[n, k] = iw * ih / ua
return overlaps

0 comments on commit 1132e83

Please sign in to comment.