say4n / pytorch-segnet

SegNet implementation in Pytorch framework
MIT License
88 stars 35 forks source link

Why do you use CrossEntropyLoss on softmax output? #5

Closed odats closed 4 years ago

odats commented 4 years ago

Model: x_softmax = F.softmax(x_00d, dim=1)

Train: https://github.com/say4n/pytorch-segnet/blob/be538aecd677b703e0cd9d803b51e33c06fa8a27/src/train.py#L73

https://pytorch.org/docs/stable/nn.html#torch.nn.CrossEntropyLoss This criterion combines nn.LogSoftmax() and nn.NLLLoss() in one single class.

say4n commented 4 years ago

Interesting find! It should be predicted_tensor instead, thanks! 😄