CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
hukaixuan19970627

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.

GitHub Repository: hukaixuan19970627/yolov5_obb
Path: blob/master/DOTA_devkit/poly_nms_gpu/poly_overlaps.pyx
Views: 475
1
import numpy as np
2
cimport numpy as np
3
4
cdef extern from "poly_overlaps.hpp":
5
void _overlaps(np.float32_t*, np.float32_t*, np.float32_t*, int, int, int)
6
7
def poly_overlaps (np.ndarray[np.float32_t, ndim=2] boxes, np.ndarray[np.float32_t, ndim=2] query_boxes, np.int32_t device_id=0):
8
cdef int N = boxes.shape[0]
9
cdef int K = query_boxes.shape[0]
10
cdef np.ndarray[np.float32_t, ndim=2] overlaps = np.zeros((N, K), dtype = np.float32)
11
_overlaps(&overlaps[0, 0], &boxes[0, 0], &query_boxes[0, 0], N, K, device_id)
12
return overlaps
13
14
15
16