设计欣赏网站,台州市建设规划局网站班子成员,自媒体写作平台,网站建站之后需要维护吗.prototxt文件 定义了网络的结构#xff0c;我们可以通过它了解网络是如何设计的#xff0c;也可以建立属于自己的网络。这种格式来源于Google的Protocol Buffers#xff0c;后来被开源#xff0c;主要用于海量数据存储、传输协议格式等场合。https://blog.csdn.net/liuyuz…
.prototxt文件 定义了网络的结构我们可以通过它了解网络是如何设计的也可以建立属于自己的网络。这种格式来源于Google的Protocol Buffers后来被开源主要用于海量数据存储、传输协议格式等场合。https://blog.csdn.net/liuyuzhu111/article/details/52253491
针对xml解析对时间和空间的开销较大的缺点进行了改进兼容多种语言向前/向后兼容具有生成代码的机制。
lenet_train_test.prototxt 是经典的lenet网络的文件使用在MNIST手写字符分类中。下面是对它的一些简单的注释name: LeNet
layer {name: mnisttype: Datatop: data //输出datatop: label //输出标签include {phase: TRAIN //在训练阶段才在网络中加入这一层}transform_param {#mean_file: mean.binaryproto //均值文件scale: 0.00390625 //对所有的图片归一化到0~1之间也就是对输入数据全部乘以scale0.0039 1/255}data_param {source: examples/mnist/mnist_train_lmdb // 从指定路径读取文件 所以没有bottombatch_size: 64 //batch大小是64 太大不行 太小也不行 等于1时是online learningbackend: LMDB //数据类型是lmdb}
}
layer {name: mnisttype: Datatop: datatop: labelinclude {phase: TEST //在测试阶段才在网络中加入这一层}transform_param {#mean_file: mean.binaryprotoscale: 0.00390625}data_param {source: examples/mnist/mnist_test_lmdbbatch_size: 100backend: LMDB}
}
layer {name: conv1type: Convolutionbottom: datatop: conv1param {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: pool1type: Poolingbottom: conv1top: pool1pooling_param {pool: MAX //最大池化kernel_size: 2 //每个pool大小是2x2
stride: 2 //步长2大小2x2所以没有重叠}
}
layer {name: conv2type: Convolutionbottom: pool1 //连接在pool1层之后 top: conv2param {lr_mult: 1}param {lr_mult: 2}convolution_param {num_output: 50kernel_size: 5stride: 1weight_filler {type: xavier}bias_filler {type: constant }}
}
layer {name: pool2type: Poolingbottom: conv2top: pool2pooling_param {pool: MAXkernel_size: 2stride: 2}
}
layer {name: ip1type: InnerProduct //内积bottom: pool2top: ip1param {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运算激活函数ReLuSigmoid等name: relu1//ReLU是按元素操作的in-place操作节省内存type: ReLU//通过让输入输出同名即新的变量代替之前的bottom: ip1top: ip1
}
layer {name: ip2type: InnerProductbottom: ip1top: ip2param {lr_mult: 1}param {lr_mult: 2}inner_product_param {num_output: 10weight_filler {type: xavier}bias_filler {type: constant}}
}
layer {name: accuracytype: Accuracybottom: ip2bottom: labeltop: accuracyinclude { //决定了这一层什么时候被包含在网络中phase: TEST // accuracy只存在于测试阶段}
}
layer {name: losstype: SoftmaxWithLossbottom: ip2bottom: labeltop: loss
}