【caffe c++】網絡配置文件說明之reshape層

下面代碼中沒註釋的部分看這篇:

【caffe c++】網絡配置文件說明之卷積層、池化層

#在不改變數據的情況下,改變輸入的維度

layer{
  name:"reshape"
  type:"Reshape"
  bottom:"input"
  top:"output"
  reshape_param{
    shape{
        dim:0  #copy the dimension from below
        dim:2
        dim:3
        dim:-1 #infer it from the other dimensions
    }
  }
}

#  有一個可選的參數組shape,用於制定blob數據的各維的值
#  blob是一個四維數據:n×c×w×h

dim:0 表示維度不變,即輸入和輸出是相同的維度

dim:2 或 dim:3 將原來的維度變成2或者3

dim:-1 表示由系統自動計算維度。數據總量不變,系統會根據blob數據的其他三維來自動計算當前維的維度值

假設原數據爲:32×3×28×28,表示323通道的28*28的彩色圖片
    shape{
        dim:0
        dim:0
        dim:14
        dim:-1  #-1表示根據前三個值,推測出來第四個值是多少
    }
輸出數據爲:32*3*14*56


## dropout是一個防止過擬合的層
## 只需要設置一個dropout_ratio就可以了

layer{
  name:"drop7"
  type:"Dropout"
  bottom:"fc7.conv"
  top:"fc7.conv"
  dropout_param{
  dropout_ratio:0.5  #每次迭代殺死百分之五十的神經元 根據過擬合現象設置,過擬合越厲害,殺死的神經元就應該越多 
  }
}

其他網絡配置文件:

【caffe c++】網絡配置文件說明之激活函數

【caffe c++】網絡配置文件說明之全連接層

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章