GuoleiSun / CountSeg

Official code for "Object counting and instance segmentation with image-level supervision", in CVPR 2019 and TPAMI 2020

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

how to understand the spatial loss

auroua opened this issue · comments

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.

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