You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
def compute_iou(self,bbox1,bbox2):
# 获取box1的第一个维度
N = bbox1.size(0)
# 获取box2的第一个维度
M = bbox2.size(0)
# Compute left-top coordinate of the intersections
#
lt = torch.max(
# [N, 2] -> [N, 1, 2] -> [N, M, 2]
bbox1[:,:2].unsqueeze(1).expand(N,M,2),
# [M, 2] -> [1, M, 2] -> [N, M, 2]
bbox2[:,:2].unsqueeze(0).expand(N,M,2)
)
rb = torch.min(
# [N, 2] -> [N, 1, 2] -> [N, M, 2]
bbox1[:, 2:].unsqueeze(1).expand(N, M, 2),
# [M, 2] -> [1, M, 2] -> [N, M, 2]
bbox2[:, 2:].unsqueeze(0).expand(N, M, 2)
)
pass
after torch.max(bbox1,bbox2),the point may be right top instead of left top
after torch.min(bbox1,bbox2),the point may be left bottom instead of right bottom
The text was updated successfully, but these errors were encountered:
def compute_iou(self,bbox1,bbox2):
# 获取box1的第一个维度
N = bbox1.size(0)
# 获取box2的第一个维度
M = bbox2.size(0)
# Compute left-top coordinate of the intersections
#
lt = torch.max(
# [N, 2] -> [N, 1, 2] -> [N, M, 2]
bbox1[:,:2].unsqueeze(1).expand(N,M,2),
# [M, 2] -> [1, M, 2] -> [N, M, 2]
bbox2[:,:2].unsqueeze(0).expand(N,M,2)
)
rb = torch.min(
# [N, 2] -> [N, 1, 2] -> [N, M, 2]
bbox1[:, 2:].unsqueeze(1).expand(N, M, 2),
# [M, 2] -> [1, M, 2] -> [N, M, 2]
bbox2[:, 2:].unsqueeze(0).expand(N, M, 2)
)
pass
after torch.max(bbox1,bbox2),the point may be right top instead of left top
after torch.min(bbox1,bbox2),the point may be left bottom instead of right bottom
The text was updated successfully, but these errors were encountered: