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.
Loss function for segmentation models - PyTorch Forums
https://discuss.pytorch.org/t/loss-function-for-segmentation-models/3212914.12.2018 · Hi, I’m trying to build a segmentation model with 3 classes. This is my way of action: 1.my output from the model is :(1,3,512,512) 2. softmax on channel dimenssion. 3. argmax on channel dimension. 4. getting (1,512,512) tensor, correct so far. When I’m trying to enter to NLLLoss2d , I’m getting an error: expected … (1,512) , and not (1,512,512) So I moved to …
Loss function for segmentation models - PyTorch Forums
discuss.pytorch.org › t › loss-function-forDec 14, 2018 · Hi, I’m trying to build a segmentation model with 3 classes. This is my way of action: 1.my output from the model is :(1,3,512,512) 2. softmax on channel dimenssion. 3. argmax on channel dimension. 4. getting (1,512,512) tensor, correct so far. When I’m trying to enter to NLLLoss2d , I’m getting an error: expected … (1,512) , and not (1,512,512) So I moved to NLLLoss , and tried to ...