LeNet网络配置文件 lenet_train_test.prototxt
生活随笔
收集整理的這篇文章主要介紹了
LeNet网络配置文件 lenet_train_test.prototxt
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
.prototxt文件 定義了網絡的結構,我們可以通過它了解網絡是如何設計的,也可以建立屬于自己的網絡。這種格式來源于Google的Protocol Buffers,后來被開源,主要用于海量數據存儲、傳輸協議格式等場合。https://blog.csdn.net/liuyuzhu111/article/details/52253491
針對xml解析對時間和空間的開銷較大的缺點進行了改進,兼容多種語言,向前/向后兼容,具有生成代碼的機制。
lenet_train_test.prototxt 是經典的lenet網絡的文件,使用在MNIST手寫字符分類中。下面是對它的一些簡單的注釋
name: "LeNet" layer {name: "mnist"type: "Data"top: "data" //輸出datatop: "label" //輸出標簽include {phase: TRAIN //在訓練階段才在網絡中加入這一層}transform_param {#mean_file: "mean.binaryproto" //均值文件scale: 0.00390625 //對所有的圖片歸一化到0~1之間,也就是對輸入數據全部乘以scale,0.0039= 1/255}data_param {source: "examples/mnist/mnist_train_lmdb" // 從指定路徑讀取文件 所以沒有bottombatch_size: 64 //batch大小是64 太大不行 太小也不行 等于1時是online learningbackend: LMDB //數據類型是lmdb} } layer {name: "mnist"type: "Data"top: "data"top: "label"include {phase: TEST //在測試階段才在網絡中加入這一層}transform_param {#mean_file: "mean.binaryproto"scale: 0.00390625}data_param {source: "examples/mnist/mnist_test_lmdb"batch_size: 100backend: LMDB} } layer {name: "conv1"type: "Convolution"bottom: "data"top: "conv1"param {lr_mult: 1 //學習率 在這種情況下,我們將設置權重學習率與求解器在運行時給出的學習率相同,//并且偏差學習率為此的兩倍 - 這通常會導致更好的收斂率。}param {lr_mult: 2}convolution_param {num_output: 20 //產生20個通道kernel_size: 5 //卷積核大小stride: 1 //卷積核滑動步長weight_filler { //權重初始化type: "xavier"//該算法將根據輸入和輸出的神經元數目自動確定初始化的規模}bias_filler { //偏置填充初始化type: "constant"}} } layer {name: "pool1"type: "Pooling"bottom: "conv1"top: "pool1"pooling_param {pool: MAX //最大池化kernel_size: 2 //每個pool大小是2x2 stride: 2 //步長2,大小2x2,所以沒有重疊} } layer {name: "conv2"type: "Convolution"bottom: "pool1" //連接在pool1層之后 top: "conv2"param {lr_mult: 1}param {lr_mult: 2}convolution_param {num_output: 50kernel_size: 5stride: 1weight_filler {type: "xavier"}bias_filler {type: "constant" }} } layer {name: "pool2"type: "Pooling"bottom: "conv2"top: "pool2"pooling_param {pool: MAXkernel_size: 2stride: 2} } layer {name: "ip1"type: "InnerProduct" //內積?bottom: "pool2"top: "ip1"param {lr_mult: 1}param {lr_mult: 2}inner_product_param {num_output: 500weight_filler {type: "xavier"}bias_filler {type: "constant"}} } layer { ?//同址計算(in-place computation,返回值覆蓋原值而占用新的內存)//neuron_layers.hpp中,其派生類主要是元素級別的運算(比如Dropout運算,激活函數ReLu,Sigmoid等name: "relu1"//ReLU是按元素操作的,in-place操作,節省內存type: "ReLU"//通過讓輸入輸出同名,即新的變量代替之前的bottom: "ip1"top: "ip1" } layer {name: "ip2"type: "InnerProduct"bottom: "ip1"top: "ip2"param {lr_mult: 1}param {lr_mult: 2}inner_product_param {num_output: 10weight_filler {type: "xavier"}bias_filler {type: "constant"}} } layer {name: "accuracy"type: "Accuracy"bottom: "ip2"bottom: "label"top: "accuracy"include { //決定了這一層什么時候被包含在網絡中phase: TEST // accuracy只存在于測試階段} } layer {name: "loss"type: "SoftmaxWithLoss"bottom: "ip2"bottom: "label"top: "loss" }
總結
以上是生活随笔為你收集整理的LeNet网络配置文件 lenet_train_test.prototxt的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Material Design入门(二)
- 下一篇: Ubantu系统配置固定IP地址和Pyc