# -*- coding: utf-8 -*-
import torch
def bbox_overlaps_giou(bboxes1, bboxes2):
"""Calculate the gious between each bbox of bboxes1 and bboxes2.
Args:
bboxes1(ndarray): shape (n, 4)
bboxes2(ndarray): shape (k, 4)
Returns:
gious(ndarray): shape (n, k)
"""
#bboxes1 = torch.FloatTensor(bboxes1)
#bboxes2 = torch.FloatTensor(bboxes2)
rows = bboxes1.shape[0]
cols = bboxes2.shape[0]
ious = torch.zeros((rows, cols))
if rows * cols == 0:
return ious
exchange = False
if bboxes1.shape[0] > bboxes2.shape[0]:
bboxes1, bboxes2 = bboxes2, bbo
GiouLoss
最新推荐文章于 2024-04-28 10:49:24 发布