目录
临时方法,用个python函数替代:
cython_bbox安装
文章转自:
解决ImportError: cannot import name ‘bbox_overlaps_cython‘_qq_43769453的博客-CSDN博客
将from cython_bbox import bbox_overlaps as bbox_ious注释掉,并在下方加上下列代码。
bbox_ious可以改为你要引用为的函数名。
def bbox_ious(
boxes,
query_boxes):
N = boxes.shape[0]
K = query_boxes.shape[0]
overlaps = np.zeros((N, K), dtype=np.float)
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(
(boxes[n, 2] - boxes[n, 0] + 1) *
(boxes[n, 3] - boxes[n, 1] + 1) +
box_area - iw * ih
)
overlaps[n, k] = iw * ih / ua
return overlaps
原文链接:https://blog.csdn.net/qq_43769453/article/details/126714601
cython_bbox库就该这么安装_大气层煮月亮的博客-CSDN博客_cython_bbox