如何在Caffe中的网络中造成多个损失?

编程入门 行业动态 更新时间:2024-10-10 02:23:27
本文介绍了如何在Caffe中的网络中造成多个损失?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

如果我在网络中定义了多个损耗层,那么从网络的两端到网络的起始端会发生多个反向传播吗?我的意思是,它们甚至可以那样工作吗?

If I define multiple loss layers in a network, will there be multiple back propagation happening from those ends to the beginning of the network? I mean, do they even work that way?

假设我有这样的东西:

Layer1{ } Layer2{ } ... Layer_n{ } Layer_cls1{ bottom:layer_n top:cls1 } Layer_cls_loss1{ type:some_loss bottom:cls1 top:loss1 } Layer_n1{ bottom:layer_n .. } Layer_n2{ } ... layer_n3{ } Layer_cls2{ bottom:layer_n3 top:cls2 } Layer_cls_loss2{ type:some_loss bottom:cls2 top:loss2 } layer_n4{ bottom:layer_n3 .. } ... layer_cls3End{ top:cls_end bottom:... } loss{ bottom:cls_end top:loss: type: someloss }

所以基本上假设不是每个网络都有一个分类/损失,我们之间也有几个分类/损失

So basically suppose instead of having one classification/loss per each network, we have several in between as well.

如果它们起作用了,我该如何将所有损失加在一起并使我的损失最终损失是先前所有损失的总和?

And in case they work, how could I add all the losses together and make my final loss the summation of all previous losses?

推荐答案

Caffe为您做到了。 此外,对于每个损失层,您都有 loss_weight 参数,可让您确定此特定损失相对于网中所有其他损失的影响力。 总体而言,通过caffe最小化的损失为加权模型中所有损耗层的总和。

Caffe does this for you. Furthermore, for each loss layer you have loss_weight parameter that allows you to decide how influential this specific loss is with respect to all other losses in the net. Overall, the loss minimized by caffe is the weighted sum of all loss layers in the model.

更多推荐

如何在Caffe中的网络中造成多个损失?

本文发布于:2023-11-26 05:11:06,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1632766.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:多个   损失   如何在   网络   Caffe

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!