GuoleiSun / CountSeg

Official code for "Object counting and instance segmentation with image-level supervision", in CVPR 2019 and TPAMI 2020
162 stars 43 forks source link

how to understand the spatial loss #6

Closed auroua closed 5 years ago

auroua commented 5 years ago

I can not understand the Lsp+ loss. The loss is computed between the pseudo ground-truth and the generated density map Dc. The BCE loss force the density map to peak at the pseudo ground-truth peak points. How to understand the effect of |S| and |B|sum in denominator.

GuoleiSun commented 5 years ago

Hi,

Thanks for your interest. |S| and |B|sum in denominator are just for normalizing the loss. Basically, it simply means that the loss is averaged over the number of peaks and number of classes in S. In pytorch, the loss has some arguments to control whether to do average or not. Please refer to https://pytorch.org/docs/stable/nn.html#torch.nn.BCEWithLogitsLoss