Pytorch semantic segmentation loss function - Stack Overflow
stackoverflow.com › questions › 67451818May 08, 2021 · Binary cross-entropy, as the name suggests is a loss function you use when you have a binary segmentation map. The CrossEntropy function, in PyTorch, expects the output from your model to be of the shape - [batch, num_classes, H, W] (pass this directly to your loss function) and the ground truth to be of shape [batch, H, W] where H, W in your case is 256, 256.