在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. Android_listView_BaseAdapter

    layout.xml <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" x ...

  2. scrollLeft,scrollWidth,clientWidth,offsetWidth 可实现导航栏固定不动(冻结)的效果

    HTML精确定位:scrollLeft,scrollWidth,clientWidth,offsetWidth  scrollHeight: 获取对象的滚动高度.  scrollLeft:设置或获取位 ...

  3. oracle中的 exists 和 in 的效率问题

    1) select * from T1 where exists(select * from T2 where T1.a=T2.a) ; T1数据量小而T2数据量非常大时,T1<<T2 时 ...

  4. Android -tool工具UIautomatorviewer提示“不能让屏幕黑屏”

    Android中有很多工具可以让我们使用,我使用比较多的有属DDMS,UIautomatorviewer,DDMS中信息也很强大,有空的时候在理理 这篇博主写的很详细:http://www.cnblo ...

  5. h2database源码浅析:锁与MVCC

    Table Level Locking The database allows multiple concurrent connections to the same database. To mak ...

  6. 查看源代码查找获取sd卡剩余容量的代码

    下载android源码,找到app下的Settings应用源码,导入Settings项目(android项目源码) 查找“可用空间”得到 <string name="memory_av ...

  7. VS打包

    同学让帮忙打包个VC的程序,程序比较简单,是带access数据库的统计查询软件,之前用Visual Studio 6.0自带的Package & Deployment Wizard 工具打包过 ...

  8. sql server 查询字符串指定字符出现的次数

    这里提取指定符串"A"在字段中的出现次数SQL为: select len(keyword)-len(replace(keyword, 'A', ' ')) from 表 原理:用r ...

  9. 【JAVA】final修饰Field

    一.简介 final修饰符可以用来修饰变量.方法.类.final修饰变量时一旦被赋值就不可以改变. 二.final成员变量 成员变量是随类初始化或对象初始化而初始化的.当类初始化的时候,会给类变量分配 ...

  10. VS2013开发Windows服务项目

    这篇随笔里,我将介绍如何用VS2013开发Windows服务项目,实现的功能是定时发送电子邮件. 开发环境:VS2013,SQL Server2008,采用C#语言开发 步骤一:创建Windows服务 ...