IDEA-Research / DINO

[ICLR 2023] Official implementation of the paper "DINO: DETR with Improved DeNoising Anchor Boxes for End-to-End Object Detection"
Apache License 2.0
2.15k stars 232 forks source link

CDN negative queries isn't used in code #142

Closed Innary closed 1 year ago

Innary commented 1 year ago

请问一下,在论文中写的 The loss to classify negative samples as background is also focal loss. 这句话,在代码中似乎CDN的负样本似乎并没有被计算损失,请问有什么原因吗,谢谢。

HaoZhang534 commented 1 year ago

Negative examples 的box loss 没有被计算,label loss被包含在focal loss的negative部分中

Innary commented 1 year ago

不好意思没有找到 label loss被包含在focal loss的negative部分 的代码。

我只在DINO.py的损失函数中看到有 l_dict.update(self.get_loss(loss, output_known_lbs_bboxes, targets, dn_pos_idx, num_boxes*scalar,**kwargs)) 并没有看到其他有关CDN的损失计算的部分,所以负例的label class输出是如何被传入 loss_labels损失函数的呢。 dn_neg_idx虽然存在,但是 dn_neg_idx似乎并没有被用到,是否是我看漏了什么或者理解错了什么

你的意思是否是指: dn_pos_idx这个match对所生成的gt标签数组里已经包含了负例的标签,所以只需要用这一组标签数组就可以计算包含正例和负例所有的损失,所以dn_neg_idx这个并不需要使用 ----- 的意思? 谢谢你

HaoZhang534 commented 1 year ago

除了dn_pos_idx以外都是neg,建议debug查看这里 https://github.com/IDEA-Research/DINO/blob/main/models/dino/dino.py#L384 ,进入focal loss 之前的input和target是包含所有queries(both positive and negative)。

Innary commented 1 year ago

好的 谢谢~