I have a segmentation problem where I feed my model images and want it to recognize only a single class. Therefore, I want to use the BCEWithLogitsLoss. However, since there are areas for which I don’t have annotation (but still want to include them in the dataset for context), I want to specify the ignore_index value so that model’s predictions in these areas are not used for computing gradients.
However, the ignore_index is only available in CrossEntropyLoss and not BCEWithLogitsLoss. I don’t understand why? Is there a reason for why it doesn’t make sense that I am missing ?
Also, is my understanding correct that I can accomplish identical behavior to ignore_index by using pos_weight?
Thank you very much!