centernet-lightning icon indicating copy to clipboard operation
centernet-lightning copied to clipboard

Output Quality Focal Loss

Open ver0z opened this issue 2 years ago • 3 comments

To use the quality focal loss did you passed to it the quality score like [0.1 0.6 0.2 0.4] or you passed the onehot from the target like [0 1 0 0] ?

ver0z avatar May 26 '22 03:05 ver0z

The inputs and targets should have the same shape, since quality focal loss treats the inputs and targets like binary cross entropy does. In particular, it is for multi-label classification.

gau-nernst avatar May 26 '22 03:05 gau-nernst

So can I use the same target from Focal Loss to Quality Focal Loss or maybe is not a good idea since focal loss have the same shape of input_prediction ? If so I only wonder if not using the quality scores given by IOU could lead me to wrong results.

ver0z avatar May 26 '22 03:05 ver0z

The shapes for inputs (model outputs) and targets for Modified Focal Loss (used in CenterNet) and Quality Focal Loss are the same. They both must have the same shape.

CenterNet creates a heatmap as the target for the loss. I'm not familiar with Quality Focal Loss paper but I think they use a different approach (something like IoU as you mention) to create the target for the loss.

Technically you can use the same target heatmap (by CenterNet) for Quality Focal Loss. From my early experiments I think doing this was worse than just using CenterNet's Focal Loss.

There is also a problem of input sampling. CenterNet apply the loss on the whole output feature map (heatmap in their terminology). For other object detection networks, I believe they only sample some points on the output feature map to apply the loss, be it Focal Loss or any other variants. For example, I think FCOS only apply the loss on the 3x3 square at each object's center. This will become problematic when you think about how to do averaging.

gau-nernst avatar May 26 '22 03:05 gau-nernst