内积/全连接 Inner Product
InnerProduct 层(也被称作全连接层)将输入看成一个一向量,输出也为向量(输出 blob的高和宽都为1)。
- 层类型: InnerProduct
- CPU 实现码: ./src/caffe/layers/inner_product_layer.cpp
- CUDA GPU 实现代码: ./src/caffe/layers/inner_product_layer.cu
参数
Required(必须的参数)
- num_output (c_o): 层的输出节点数或者理解为滤波器的个数
Strongly Recommended(强力推荐)
- weight_filler [default
type: 'constant' value: 0
]: 参数的初始化方法
Optional(可选的)
- bias_filler [default type: 'constant' value: 0]
bias_term
[defaulttrue
]: 指定是否给每个滤波器添加并训练偏置项
输入
- n * c_i * h_i * w_i
输出
- n * c_o * 1 * 1
例子:
layer {
name: "fc8"
type: "InnerProduct"
# learning rate and decay multipliers for the weights
param { lr_mult: 1 decay_mult: 1 }
# learning rate and decay multipliers for the biases
param { lr_mult: 2 decay_mult: 0 }
inner_product_param {
num_output: 1000
weight_filler {
type: "gaussian"
std: 0.01
}
bias_filler {
type: "constant"
value: 0
}
}
bottom: "fc7"
top: "fc8"
}
name: "fc8"
type: "InnerProduct"
# learning rate and decay multipliers for the weights
param { lr_mult: 1 decay_mult: 1 }
# learning rate and decay multipliers for the biases
param { lr_mult: 2 decay_mult: 0 }
inner_product_param {
num_output: 1000
weight_filler {
type: "gaussian"
std: 0.01
}
bias_filler {
type: "constant"
value: 0
}
}
bottom: "fc7"
top: "fc8"
}