bbox_overlaps python
【摘要】
python:
def bbox_overlaps_py(boxes, query_boxes): """ determine overlaps between boxes and query_boxes :param boxes: n * 4 bounding boxes :param query_boxes: k * 4 bounding boxes :...
python:
-
def bbox_overlaps_py(boxes, query_boxes):
-
"""
-
determine overlaps between boxes and query_boxes
-
:param boxes: n * 4 bounding boxes
-
:param query_boxes: k * 4 bounding boxes
-
:return: overlaps: n * k overlaps
-
"""
-
n_ = boxes.shape[0]
-
k_ = query_boxes.shape[0]
-
overlaps = np.zeros((n_, k_), dtype=np.float)
-
for k in range(k_):
-
query_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:
-
box_area = (boxes[n, 2] - box
文章来源: blog.csdn.net,作者:网奇,版权归原作者所有,如需转载,请联系作者。
原文链接:blog.csdn.net/jacke121/article/details/115497529
【版权声明】本文为华为云社区用户转载文章,如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱:
cloudbbs@huaweicloud.com
- 点赞
- 收藏
- 关注作者
评论(0)