作者:wjmishuai

出处: http://blog.csdn.net/wjmishuai/article/details/50890214

    1. 原始数据是28*28
    2. 1:数据层:
    3. layer {
    4. name: "mnist"//数据层的名字是mnist
    5. type: "Data"//这个层的类型是data
    6. top: "data"//产生两个blob,一个是data blob
    7. top: "label"//一个是lable blob
    8. include {
    9. phase: TRAIN
    10. }
    11. transform_param {
    12. scale: 0.00390625//像素归一化
    13. }
    14. data_param {
    15. source: "examples/mnist/mnist_train_lmdb"
    16. batch_size: 64
    17. backend: LMDB
    18. }
    19. }
    20. 2:卷积层
    21. layer {
    22. name: "conv1"
    23. type: "Convolution"
    24. bottom: "data"//获取上一层的data blob
    25. top: "conv1"//产生conv1层
    26. param {
    27. lr_mult: 1//学习率。表示 weight的学习率和slover.pro中的学习率是一致的。
    28. }
    29. param {
    30. lr_mult: 2//表示 bias的学习率是slover.pro中的学习率的2倍。  这样设置会导致更快的收敛
    31. }
    32. convolution_param {
    33. num_output: 20//cov1层将产生输出20个通道
    34. kernel_size: 5//卷积核大小是5*5
    35. stride: 1//步长是1
    36. weight_filler {//权重填充器,使用xavier算法填充weight。根据输入和输出神经元的数量自动确定初始化的规模。
    37. type: "xavier"
    38. }
    39. bias_filler {//偏置填充器,使用constant算法填充bias。是一个常数,默认是0
    40. type: "constant"
    41. }
    42. }
    43. }
    44. 3:池化层(避免数据过拟合)
    45. layer {
    46. name: "pool1"
    47. type: "Pooling"
    48. bottom: "conv1"
    49. top: "pool1"
    50. pooling_param {
    51. pool: MAX//使用MAX进行池化
    52. kernel_size: 2//卷积核大小是2*2
    53. stride: 2//步长是2
    54. }
    55. }
    56. 4:全连接层
    57. layer {
    58. name: "ip1"
    59. type: "InnerProduct"
    60. bottom: "pool2"
    61. top: "ip1"
    62. param {
    63. lr_mult: 1
    64. }
    65. param {
    66. lr_mult: 2
    67. }
    68. inner_product_param {
    69. num_output: 500//产生500维的输出数据
    70. weight_filler {
    71. type: "xavier"
    72. }
    73. bias_filler {
    74. type: "constant"
    75. }
    76. }
    77. }
    78. 5:ReLU层(紧跟在全连接层后,目的是节省内存)
    79. layer {
    80. name: "relu1"
    81. type: "ReLU"
    82. bottom: "ip1"
    83. top: "ip1"
    84. }
    85. ReLU层后紧跟一个InnerProduct层
    86. layer {
    87. name: "ip2"
    88. type: "InnerProduct"
    89. bottom: "ip1"
    90. top: "ip2"
    91. param {
    92. lr_mult: 1
    93. }
    94. param {
    95. lr_mult: 2
    96. }
    97. inner_product_param {
    98. num_output: 10//因为有10类,所以输出10
    99. weight_filler {
    100. type: "xavier"
    101. }
    102. bias_filler {
    103. type: "constant"
    104. }
    105. }
    106. }
    107. 6:Loss层//不产生任何输出,只是用来计算损失函数的值,用来初始化ip2的gradient
    108. layer {
    109. name: "loss"
    110. type: "SoftmaxWithLoss"
    111. bottom: "ip2"//需要两个blob,一个是ip2,作为预测用
    112. bottom: "label"//来自数据层,作为标签
    113. top: "loss"
    114. }

name: 表示该层的名称,可随意取

type: 层类型,如果是Data,表示数据来源于LevelDB或LMDB。根据数据的来源不同,数据层的类型也不同(后面会详细阐述)。一般在练习的时候,我们都是采 用的LevelDB或LMDB数据,因此层类型设置为Data。

top或bottom: 每一层用bottom来输入数据,用top来输出数据。如果只有top没有bottom,则此层只有输出,没有输入。反之亦然。如果有多个 top或多个bottom,表示有多个blobs数据的输入和输出。

data 与 label: 在数据层中,至少有一个命名为data的top。如果有第二个top,一般命名为label。 这种(data,label)配对是分类模型所必需的。

include: 一般训练的时候和测试的时候,模型的层是不一样的。该层(layer)是属于训练阶段的层,还是属于测试阶段的层,需要用include来指定。如果没有include参数,则表示该层既在训练模型中,又在测试模型中。

Transformations: 数据的预处理,可以将数据变换到定义的范围内。如设置scale为0.00390625,实际上就是1/255, 即将输入数据由0-255归一化到0-1之间

caffe模型参数解释的更多相关文章

  1. 梯度优化算法总结以及solver及train.prototxt中相关参数解释

    参考链接:http://sebastianruder.com/optimizing-gradient-descent/ 如果熟悉英文的话,强烈推荐阅读原文,毕竟翻译过程中因为个人理解有限,可能会有谬误 ...

  2. CNN tflearn处理mnist图像识别代码解说——conv_2d参数解释,整个网络的训练,主要就是为了学那个卷积核啊。

    官方参数解释: Convolution 2D tflearn.layers.conv.conv_2d (incoming, nb_filter, filter_size, strides=1, pad ...

  3. LTE Module User Documentation(翻译1)——背景、使用概述、基本的仿真程序和配置LTE模型参数

    LTE用户文档 (如有不当的地方,欢迎指正!) 1.背景 假定读者已经熟悉 ns-3 simulator ,能运行一般的仿真程序.如果不是的话,强烈推荐读者参考 [ns3tutorial].   2. ...

  4. Yolov3参数解释以及答疑

    目录 参数解析 训练答疑 ​ 参数解析 [net] #Testing #batch=1 //test:一次一个图片 #subdivisions=1 #Training batch=32 //一次迭代送 ...

  5. (原)linux下caffe模型转tensorflow模型

    转载请注明出处: http://www.cnblogs.com/darkknightzh/p/7419352.html 参考网址: https://github.com/ethereon/caffe- ...

  6. my.cnf 配置文件参数解释

    my.cnf 配置文件参数解释: #*** client options 相关选项 ***# #以下选项会被MySQL客户端应用读取.注意只有MySQL附带的客户端应用程序保证可以读取这段内容.如果你 ...

  7. TensorFlow模型转为caffe模型

    最近由于要将训练好的模型移植到硬件上,因此需要将TensorFlow转为caffe模型. caffe模型需要两个文件,一个是定义网络结构的prototxt,一个是存储了参数的caffemodel文件. ...

  8. Caffe模型读取

    caffe模型最终保存使用过的protobuf形式,将一个已经训练好的caffe模型读取出来,可以参考如下: 1,包含的头文件: #include <google/protobuf/io/cod ...

  9. TensorFlow Object Detection API中的Faster R-CNN /SSD模型参数调整

    关于TensorFlow Object Detection API配置,可以参考之前的文章https://becominghuman.ai/tensorflow-object-detection-ap ...

随机推荐

  1. AtCoder Grand Contest 025 B - RGB Coloring

    B - RGB Coloring 求ax + by = k (0<=x<=n && 0<=y<=n)的方案数,最后乘上C(n, x)*C(n,y) 代码: #i ...

  2. Codeforces 374C - Inna and Dima

    374C - Inna and Dima 思路:dfs+记忆化搜索 代码: #include<bits/stdc++.h> using namespace std; #define ll ...

  3. [C#]获取连接MySql数据库及常用的CRUD操作

    测试如下: 首先添加引用:MySql.Data.dll 链接:http://pan.baidu.com/s/1dEQgLpf 密码:bnyu *将链接数据库的信息放入配置文件中(app.config) ...

  4. (转)C#反射使用时注意BindingFlags的用法

    c#反射查找方法时,默认只能查到public方法.如果想要查找private方法,需要设定BindingFlags. 即: BindingFlags.Public|BindingFlags.Insta ...

  5. putty 显示 ubuntu的文件乱码

    http://www.linuxidc.com/Linux/2012-01/52252.htm 下面几个注意点 1) Windows - Appearance - Font settings 里可以更 ...

  6. 雷林鹏分享:C# 程序结构

    C# 程序结构 在我们学习 C# 编程语言的基础构件块之前,让我们先看一下 C# 的最小的程序结构,以便作为接下来章节的参考. C# Hello World 实例 一个 C# 程序主要包括以下部分: ...

  7. springboot---->错误: 找不到或无法加载主类

    刚开始是往上面箭头指出的方向去找问题的原因,但是试了各种方法后问题还是没有解决,于是乎我把焦点转去查看eclipsede控制台处: 主要的错误提示如下: Archive for required li ...

  8. Lab 3-1

    Analyze the malware found in the file Lab03-01.exe using basic dynamic analysis tools. Questions and ...

  9. 31. Next Permutation (java 字典序生成下一个排列)

    题目: Implement next permutation, which rearranges numbers into the lexicographically next greater per ...

  10. HDU-2586-裸LCA入门-tarjan离线

    http://acm.hdu.edu.cn/showproblem.php?pid=2586 给出一颗树和边权,询问两点距离. 考虑tarjan离线做法,做法很巧妙,当前进行到u,对他的儿子v,当v子 ...