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.31k stars 258 forks source link

关于PAN多级特征融合在维持原图比例不变时,填充区域的Attention Mask如何使用的问题 #372

Open urbaneman opened 2 months ago

urbaneman commented 2 months ago

感谢您的工作和对开源社区的贡献。

我想在自己的数据使用RT-DETR,数据目标在原尺度为正方形目标,我想利用这个信息,在数据处理时保持原图比例,我也参考了这个issue13,但是里面没有 Attention Mask 相关讨论。

我想咨询的问题是: 在图像保持原图比例缩放时,会引入填充像素,填充部分的Attention Mask在DETR中会被置为1,并在encode的时候忽略

https://github.com/facebookresearch/detr/blob/29901c51d7fe8712168b8d0d64351170bc0f83e0/models/backbone.py#L72

但是在 RT-DETR 中采用直接resize的方法,没有填充,keep_ratio: False,Attention Mask作用在了CDN中

https://github.com/lyuwenyu/RT-DETR/blob/5b628eaa0a2fc25bdafec7e6148d5296b144af85/rtdetr_pytorch/src/zoo/rtdetr/hybrid_encoder.py#L299

我需要在原图比例上使用RT-DETR,那么PAN结构的特征融合时填充像素特征是否会影响非填充目标特征的表达是否需要对遮挡像素的特征做mask?