我正在尝试使用 caffe 来实现
渐变 w.r.t 锚"输入 (fa):
梯度 w.r.t 正"输入 (fp):
梯度 w.r.t 负"输入 (fn):
原来的计算(我出于感情原因离开这里……)
请参阅评论 更正最后一项.
I am trying to use caffe to implement triplet loss described in Schroff, Kalenichenko and Philbin "FaceNet: A Unified Embedding for Face Recognition and Clustering", 2015.
I am new to this so how to calculate the gradient in back propagation?
解决方案I assume you define the loss layer as
layer { name: "tripletLoss" type: "TripletLoss" bottom: "anchor" bottom: "positive" bottom: "negative" ... }Now you need to compute a gradient w.r.t each of the "bottom"s.
The loss is given by:
The gradient w.r.t the "anchor" input (fa):
The gradient w.r.t the "positive" input (fp):
The gradient w.r.t the "negative" input (fn):
The original calculation (I leave here for sentimental reasons...)
Please see comment correcting the last term.
更多推荐
三重损失反向传播梯度公式是什么?
发布评论