Open tms2003 opened 12 months ago
rtdetr没有背景类 只有背景图片的话target里都是空tensor就行
def generalized_box_iou(boxes1, boxes2): """ Generalized IoU from https://giou.stanford.edu/
The boxes should be in [x0, y0, x1, y1] format
Returns a [N, M] pairwise matrix, where N = len(boxes1)
and M = len(boxes2)
"""
# degenerate boxes gives inf / nan results
# so do an early check
# print(boxes1[:, 2:])
# print('===============',boxes1[:, :2])
# assert (boxes1[:, 2:] >= boxes1[:, :2]).all()
# assert (boxes2[:, 2:] >= boxes2[:, :2]).all()
iou, union = box_iou(boxes1, boxes2)
lt = torch.min(boxes1[:, None, :2], boxes2[:, :2])
rb = torch.max(boxes1[:, None, 2:], boxes2[:, 2:])
wh = (rb - lt).clamp(min=0) # [N,M,2]
epsilon = torch.tensor(1e-7, device=torch.cuda.current_device())
epsilon.requires_grad_()
area = wh[:, :, 0] * wh[:, :, 1]+epsilon
return iou - (area - union) / (area)您好请问下这个出现nan是不是空样本造成的问题,训练前10代可以后面就判断跑错
yolov5/v8都考虑了一些未包含任何目标的图像作为背景图像的问题。请问[RT-DETR]是否训练时考虑了这个问题?如果是,coco数据集的标注为0吗?