Hi!
I was wondering which is the correct way to perform element wise binary classification using the BCEloss.
My model outputs a tensor of shape (depth, width, length) and its last activation is an element wise Sigmoid.
My target contains either 0 or 1 and has also shape (depth, width, length).
I am currently computing the loss with the default reduction “mean” and I backpropagate this.
The mean loss decreases as expected however my model predicts for all pixels probabilities that are lower than 0.5 so all the elements equal to 1 are wrongly classified.
I think that this is mainly due to the fact that the 1s are rare in the tensor.
Should I change loss? In particular I was wondering if I should use reduction=none? If yes how can I backpropagate this elementwise loss?
Thanks in advance,
Luca