implus / GFocalV2

Generalized Focal Loss V2: Learning Reliable Localization Quality Estimation for Dense Object Detection, CVPR2021

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Question on how to weight the box loss with quality score?

huangh12 opened this issue · comments

Hi @implus , thanks for the impressive GFocal/GFocalV2 work. From the paper, the box related loss is weigted by the quality score.
图片
However, I've read the released GFocal and GFocalV2 code, and find the weighting detail differs from the mmdetetion/FCOS offical code.
Specifically, in GFocal/GFocalV2, the weight is the predicted quality score i.e., cls_score.

weight_targets = cls_score.detach()

while in the mmdetetion, the weight is the targeted quality score, i.e., centerness_targets.
https://github.com/open-mmlab/mmdetection/blob/321eb30034602085821b710108fb4ce4323f69f9/mmdet/models/dense_heads/atss_head.py#L201

Is your weighting mechinam an intented design or just a typo? Did you find any accuracy gain from yours? From my point of view, using quality target to weight the box loss seems more rational. Because at the begining of training, the predicted quality score could be very noisy, which may hamper the box regression.

In our prior experiments, using predicted quality has no difference with using targeted one in final performance. But I prefer using the predicted one because it is more aligned with prediction formula during inference, i.e., if our detector can not make accurate prediction on quality scores of certain valid targets, it makes no sence to assign it with higher learning weight.