在caffe中,网络的结构由prototxt文件中给出,由一些列的Layer(层)组成,常用的层如:数据加载层、卷积操作层、pooling层、非线性变换层、内积运算层、归一化层、损失计算层等;本篇主要介绍loss层

1. loss层总述

下面首先给出全loss层的结构设置的一个小例子(定义在.prototxt文件中)

layer {
name: "loss"
type: "SoftmaxWithLoss" //loss fucntion的类型
bottom: "pred" //loss fucntion的输入数据blob,即网络的预测值lable
bottom: "label" //loss function的另外一个输入数据blob,即数据集的真实label
top: "loss" //loss的输出blob,即分类器的loss 值
}

2. loss function类型

粗略地讲,loss function是用来衡量估计值和真实值之间的误差情况的;在caffe中,包含了常用的loss function,目前主要有以下几种:

【Loss drives learning by comparing an output to a target and assigning cost to minimize. The loss itself is computed by the forward pass and the gradient w.r.t. to the loss is computed by the backward pass.】

(1)softmax:图像多类分类问题中主要就是用它

  • Layer type: SoftmaxWithLoss

(2)Sum-of-Squares / Euclidean:主要用在线性回归中

  • Layer type: EuclideanLoss

(3)Hinge / Margin:主要用在SVM分类器中

  • Layer type: HingeLoss

(4)Sigmoid Cross-Entropy

  • Layer type: SigmoidCrossEntropyLoss

(5)Infogain

  • Layer type: InfogainLoss
 参考:caffe tutorial

caffe之(五)loss层的更多相关文章

  1. caffe实现focal loss层的一些理解和对实现一个layer层易犯错的地方的总结

    首先要在caffe.proto中的LayerParameter中增加一行optional FocalLossParameter focal_loss_param = 205;,然后再单独在caffe. ...

  2. caffe 中 python 数据层

    caffe中大多数层用C++写成. 但是对于自己数据的输入要写对应的输入层,比如你要去图像中的一部分,不能用LMDB,或者你的label 需要特殊的标记. 这时候就需要用python 写一个输入层. ...

  3. caffe添加python数据层

    caffe添加python数据层(ImageData) 在caffe中添加自定义层时,必须要实现这四个函数,在C++中是(LayerSetUp,Reshape,Forward_cpu,Backward ...

  4. caffe中softmax loss源码阅读

    (1) softmax loss <1> softmax loss的函数形式为:     (1) zi为softmax的输入,f(zi)为softmax的输出. <2> sof ...

  5. caffe(5) 其他常用层及参数

    本文讲解一些其它的常用层,包括:softmax_loss层,Inner Product层,accuracy层,reshape层和dropout层及其它们的参数配置. 1.softmax-loss so ...

  6. caffe中的BatchNorm层

    在训练一个小的分类网络时,发现加上BatchNorm层之后的检索效果相对于之前,效果会有提升,因此将该网络结构记录在这里,供以后查阅使用: 添加该层之前: layer { name: "co ...

  7. caffe之(二)pooling层

    在caffe中,网络的结构由prototxt文件中给出,由一些列的Layer(层)组成,常用的层如:数据加载层.卷积操作层.pooling层.非线性变换层.内积运算层.归一化层.损失计算层等:本篇主要 ...

  8. (原)torch和caffe中的BatchNorm层

    转载请注明出处: http://www.cnblogs.com/darkknightzh/p/6015990.html BatchNorm具体网上搜索. caffe中batchNorm层是通过Batc ...

  9. caffe源码 卷积层

    通俗易懂理解卷积 图示理解神经网络的卷积 input: 3 * 5 * 5 (c * h * w) pading: 1 步长: 2 卷积核: 2 * 3 * 3 * 3 ( n * c * k * k ...

随机推荐

  1. win8上装Oracle 12c Client

    安装之前要保证已装Microsoft Visual C++ Redistributable 32 bit: http://www.microsoft.com/download/en/details.a ...

  2. (转)STL

    C++容器类 C++中的容器类包括“顺序存储结构”和“关联存储结构”,前者包括vector,list,deque等:后者包括set,map,multiset,multimap等. 若需要存储的元素数在 ...

  3. mysql计算连续天数,mysql连续登录天数,连续天数统计

    mysql计算连续天数,mysql连续登录天数,连续天数统计 >>>>>>>>>>>>>>>>>& ...

  4. JAXB - The Object Factory

    Usually hidden in the middle of the list of the classes derived from the types defined in an XML sch ...

  5. scala学习笔记:match与unapply()

    编写如下代码: object MatchTest { def foo(a : Any) : String = { a match { case 1 => "int:1" ca ...

  6. web app开发中 iPhone、iPad默认按钮样式问题

    webapp开发过程中,用html5+css3很方便,而且可以很方便的编译到Android ios等不同平台,但是ios需要单独处理一下,不然会出现一些想象不到的问题.下面就介绍一下各种问题的解决方法 ...

  7. 16_会话技术_Session案例

    [购物车中的信息保存] [Book.java] package com.Higgin.shopping; public class Book { private String id; private ...

  8. php 加密解密方法

    <?php//可用于加密解密,如cookie,账号,手机号 as so on class DES { var $key; var $iv; //偏移量 function __construct( ...

  9. css中>,+,~的用法

    1.>的用法 A>B选择A的所有子元素B(只选择一代) 2.+的用法 A+B选择紧随着A的兄弟元素B 3.~的用法 A~B选择位置处于A后面的所有兄弟元素B(不包含兄弟元素的子元素)

  10. CSS3 animation-fill-mode 属性

    现在专注于移动端开发项目,对于动画这个点是非常重要的,每当我遇到一个新的知识点,我就会和大家一起分享 animation-fill-mode :把物体动画地从一个地方移动到另一个地方,并让它停留在那里 ...