Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the difference between Softmax and SoftmaxWithLoss layer in caffe?

While defining prototxt in caffe, I found sometimes we use Softmax as the last layer type, sometimes we use SoftmaxWithLoss, I know the Softmax layer will return the probability the input data belongs to each class, but it seems that SoftmaxwithLoss will also return the class probability, then what's the difference between them? or did I misunderstand the usage of the two layer types?

like image 652
Eric Luo Avatar asked Dec 05 '16 12:12

Eric Luo


1 Answers

While Softmax returns the probability of each target class given the model predictions, SoftmaxWithLoss not only applies the softmax operation to the predictions, but also computes the multinomial logistic loss, returned as output. This is fundamental for the training phase (without a loss there will be no gradient that can be used to update the network parameters).

See SoftmaxWithLossLayer and Caffe Loss for more info.

like image 151
Lemm Ras Avatar answered Sep 26 '22 01:09

Lemm Ras