Caffe之网络输出

1、fc层

例如caffenet的fc8层:

layer {  
  name: "fc8"  
  type: "InnerProduct"  
  bottom: "fc7"  
  top: "fc8"  
  param {  
    lr_mult: 1  
    decay_mult: 1  
  }  
  param {  
    lr_mult: 2  
    decay_mult: 0  
  }  
  inner_product_param {  
    num_output: 1000  
    weight_filler {  
      type: "gaussian"  
      std: 0.01  
    }  
    bias_filler {  
      type: "constant"  
      value: 0  
    }  
  }  
}

最后一个全连接层:神经元个数 = 类别数, 输出值位于区间[−∞,∞],并不是概率值,输出数值最大的值的index就是样本的预测类别;


2、Accuracy层

例如caffenet的accuracy层:

layer {  
  name: "accuracy"  
  type: "Accuracy"  
  bottom: "fc8"  
  bottom: "label"  
  top: "accuracy"  
  include {  
    phase: TEST  
  }  
}

Accuracy = fc8层 输出 对比 数据集的labels,在AccuracyLayer中实现;

3、Softmax function

layer {  
  name: "prob"  
  type: "Softmax"  
  bottom: "fc8"  
  top: "prob"  
}

为了使输出具有统计意义,需要加入softmax function输出似然值。

softmax function是增函数,它使前面的全连接层输出(fc8)具有了概率意义,并不改变这些输出之前的大小关系; 


4、loss function

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

为了利用误差反向传播,还需要构造loss function,利用softmax function的输出,即输入样本属于每一类的概率值;

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

(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

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Bicelove

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值