Caffe Prototxt 特殊层系列:Softmax Layer

24 篇文章 12 订阅
16 篇文章 4 订阅

Softmax Layer作用是将分类网络结果概率统计化,常常出现在全连接层后面

CNN分类网络中,一般来说全连接输出已经可以结束了,但是全连接层的输出的数字,有大有小有正有负,人看懂不说,关键是训练时,它无法与groundtruth对应(不在同一量级上),所以用Softmax Layer将其概率统计化,将输出归一化为和为1的概率值;这样我们能一眼看懂,关键是SoftmaxWithLossLayer也可以计算loss值

首先我们先看一下 SoftmaxParameter

// Message that stores parameters used by SoftmaxLayer, SoftmaxWithLossLayer
message SoftmaxParameter {
	  enum Engine {
	    DEFAULT = 0;
	    CAFFE = 1;
	    CUDNN = 2;
	  }
	  optional Engine engine = 1 [default = DEFAULT];
	
	  // The axis along which to perform the softmax -- may be negative to index
	  // from the end (e.g., -1 for the last axis).
	  // Any other axes will be evaluated as independent softmaxes.
	  optional int32 axis = 2 [default = 1];
}

Softmax Layer在prototxt里面的书写:

layers {
	  name: "prob"
	  type: “Softmax"
	  bottom: " fc"
	  top: "prob"
}

SoftmaxWithLossLayer在prototxt里面的书写:

layer {
	  name: "loss"
	  type: "SoftmaxWithLoss"
	  bottom: "prob"
	  bottom: "label"
	  top: "loss"
}
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值