我试图解释和理解用Caffe .proto编写的模型。
昨天,我遇到了Shai in here的一个示例here,引用如下:
layer {
name: "ip1_a"
bottom: "data_a"
top: "ip1_a"
type: "InnerProduct"
inner_product_param {
num_output: 10
}
param {
name: "ip1_w" # NOTE THIS NAME!
lr_mult: 1
}
param {
name: "ip1_b"
lr_mult: 2
}
}
layer {
name: "ip1_b"
bottom: "data_b"
top: "ip1_b"
type: "InnerProduct"
inner_product_param {
num_output: 10
}
param {
name: "ip1_w" # NOTE THIS NAME: it's the same!
lr_mult: 10 # different LR for this branch
}
param {
name: "ip1_b"
lr_mult: 20
}
}
# one layer to combine them
layer {
type: "Concat"
bottom: "ip1_a"
bottom: "ip1_b"
top: "ip1_combine"
name: "concat"
}
layer {
name: "joint_ip"
type: "InnerProduct"
bottom: "ip1_combine"
top: "joint_ip"
inner_product_param {
num_output: 30
}
} 我对这一模式的定义理解为:
data_a data_b
| |
| |
------- -------
| ip1_a | | ip1_b |
------- -------
| |
| |
ip1_a ip1_b
| |
| |
V V
~~~~~~~~~~~~~~~
|
|
V
-------------
| concat |
-------------
|
|
ip1_combine
|
|
-------------
| joint_ip |
-------------
|
|
joint_ip blob ip1_a由层ip1_a训练,权重用ip1_w初始化(lr:1),偏置用ip1_b初始化(lr:2)。blob ip1_a实际上是使用ip1_w初始化的新学习权重。学到的偏见没有名字。
在一些模型中,我们可以发现一些层有:
lr_mult:1
lr_mult:2其中,lr_mult的第一个实例总是对应于权重,下一个实例对应的是偏差。
我以上的理解正确吗?
发布于 2015-12-01 06:38:30
您正在混合两种数据类型:输入(培训)数据和网络参数。
在训练期间,输入数据被固定到已知的训练/验证集,并且只有网络参数被改变。相反,在部署网络时,当网络参数固定时,数据会更改为新映像。有关caffe存储这两种类型数据的方式的深入描述,请参见this answer。
在您展示的示例中,有两个输入训练数据路径:data_a和data_b,它们每次可能是不同的图像。输入小块通过InnerProduct层分别成为ip1_a和ip1_b块。然后将它们连接到一个blob ip1_combined中,该blob又被输入到最终的InnerProduct层。
另一方面,模型有一组参数:第一内积层的ip1_w和ip1_b (权值和偏差)。在这个特殊的例子中,该层的参数被显式命名,以表明它们在ip1_a和ip1_b层之间是共享的。
对于两个lr_mult:是的,第一个是权重的LR乘数,第二个是偏置项。
https://stackoverflow.com/questions/34013520
复制相似问题