I am having hard time understanding the BCEWITHLOGITLOSS
Hello everyone recently i am working on a assignment where i have to predict mask of image using foreground_background image,background image.I used bcewithlogitloss bcz i changed my target value as combination of 1 and 0 where 1 is for foreground and 0 is for background.So my results are pretty good but i am not still convinced why i used bcewithlogitloss.It is a reconstruction problem where i am using probabilty distribution(bcewithlogitloss).SO can anyone plz hepl me why i can use bcewithlogitloss in this example.Thank you

The task you're describing is semantic segmentation, where the model predicts a mask for the image.



In the mask, for every input pixel, there are 2 possible categories. Either 0 (black) for background, and 1 (white) for foreground.

So, technically, it's a classification problem with 2 classes.

We commonly use binary cross-entropy for binary classification problems (why), hence BCE is a good fit here. Finally, the withLogit part means, the sigmoid activation will be applied internally, your model won't need a separate activation layer (details).
