lyuwenyu / RT-DETR

[CVPR 2024] Official RT-DETR (RTDETR paddle pytorch), Real-Time DEtection TRansformer, DETRs Beat YOLOs on Real-time Object Detection. 🔥 🔥 🔥
Apache License 2.0
2.61k stars 303 forks source link

是否考虑了背景图片的问题? #134

Open tms2003 opened 12 months ago

tms2003 commented 12 months ago

yolov5/v8都考虑了一些未包含任何目标的图像作为背景图像的问题。请问[RT-DETR]是否训练时考虑了这个问题?如果是,coco数据集的标注为0吗?

lyuwenyu commented 12 months ago

rtdetr没有背景类 只有背景图片的话target里都是空tensor就行

wenshuaishuai123 commented 8 months ago

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 是一个需要梯度的张量

epsilon.requires_grad_()
area = wh[:, :, 0] * wh[:, :, 1]+epsilon

return iou - (area - union) / (area)您好请问下这个出现nan是不是空样本造成的问题,训练前10代可以后面就判断跑错