def _loss_proto(self, xPr, xLb, xSemPr, xSemLb, lCW):
ns = self.netspec
# Classification loss
if self.sem_coeff < 1:
name = 'SCoRe/objLoss'
ns[name] = L.SoftmaxWithLoss(*[xPr, xLb], name=name, loss_weight=1.0 - self.sem_coeff, include=dict(phase=caffe.TRAIN))
# Semantic regularization
if self.sem_coeff > 0:
self._semantic_regularization(xSemPr, xSemLb, self.sem_coeff)
# Codeword regularization
if 0 < self.code_coeff < np.inf:
self._code_regularization(lCW)
评论列表
文章目录