ssudholt / phocnet

BSD 3-Clause "New" or "Revised" License
38 stars 28 forks source link

Is loss function applied to fc8 layer, but not to sigmoid layer? #6

Closed ghost closed 6 years ago

ghost commented 6 years ago

Does the code 'n.loss = L.SigmoidCrossEntropyLoss(n.fc8, n.phocs)' implies that cross entropy loss function was used with the output of last fully connected layer with linear activation?

ssudholt commented 6 years ago

In Caffe, the SigmoidCrossEntropyLoss layer combines both sigmoid activation and the binary cross entropy loss in one layer in order to provide numerical stability. At test/retrieval time, the sigmoid activation is added as a dedicated layer in order to get the output of fc8 in the correct range.

ghost commented 6 years ago

Thank you very much!