One hot encoding for BCE loss?

Hi all,

Iam wondering if I need to one-hot encode labels for a segmentation task when using BCEwithoutLogits?
The pixels in my segmentation masks are either 0 (background) or 1(foreground).

In some code examples I saw that labels where on-hot encoded, in others the output channel of the model is equal to 1.

So I now Iam somewhat confused…

Thanks in advance,



Hi Michael!

Please see my final comment in this reply to your other thread:


K. Frank