Semantic segmentation loss

Hi all, is there anyone which have implemented a Pixel-wise binary cross entropy loss? I need for the a semantic segmentation and I found a very little bit in pytorch documentation.
Can anyone help me?

1 Like

Isn’t BCELoss — PyTorch 1.12 documentation what you need ? It is already working pixel-wise.

1 Like

@Lelouch1 is right and nn.BCELoss will also work pixel-wise. Small NIT: use nn.BCEWithLogitsLoss for better numerical stability.

1 Like

I didn’t know that BCE works as pixel-wise. I know that the one with logits has a numerical stability, Thanks a lot.