yolo_v1_pytorch icon indicating copy to clipboard operation
yolo_v1_pytorch copied to clipboard

the error of compute_iou in loss.py

Open StephenZhao1 opened this issue 4 years ago • 1 comments

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

StephenZhao1 avatar Feb 24 '21 01:02 StephenZhao1

这确实是错误了,好像很多人的代码也这么祖传的错下去

xibici avatar May 03 '23 03:05 xibici