Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion second/core/non_max_suppression/nms_gpu.py
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,9 @@ def point_in_quadrilateral(pt_x, pt_y, corners):
adad = ad0 * ad0 + ad1 * ad1
adap = ad0 * ap0 + ad1 * ap1

return abab >= abap and abap >= 0 and adad >= adap and adap >= 0
#return abab >= abap and abap >= 0 and adad >= adap and adap >= 0
eps = -1e-6
return abab - abap >= eps and abap >= eps and adad - adap >= eps and adap >= eps


@cuda.jit('(float32[:], float32[:], float32[:])', device=True, inline=True)
Expand Down
18 changes: 18 additions & 0 deletions second/core/non_max_suppression/test_nms_gpu.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
from nms_gpu import rotate_iou_gpu_eval
import numpy as np

def main():
boxes = np.array([
[0, 0, 1, 2., 0.1],
[0, 0, .001, 2., 0.1],
[0, 0, 0.1, 2., 0.5],
[0, 0, 0.1, 2., -np.pi/2],
])

ious = np.diag( rotate_iou_gpu_eval(boxes, boxes) )
print(f"ious: {ious}")
#old: [0. 0. 0.33333316 0. ]
#new: [1. 0.99998605 0.99999934 1. ]

if __name__ == '__main__':
main()