DL學習筆記【11】caffe引數調節-loss層
阿新 • • 發佈:2019-01-26
轉自:http://www.cnblogs.com/lutingting/p/5240688.html
在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