下面代码中没注释的部分看这篇:
#全连接层,输出的是一个简单向量 参数跟卷积层一样
layer {
name:"ip1"
type:"InnerProduct"
bottom:"pool2"
top:"ip1"
param{ #学习率
lr_mult:1
}
param {
lr_mult:2
}
inner_product_param {
num_output:500 #输出向量的大小
weight_filler{
type:"xavier"
}
bias_filler{
type:"constant"
}
}
}
###测试的时候输入准确率
layer{
name:"accuracy"
type:"Accuracy"
bottom:"ip2"
bottom:"label"
top:"accuracy"
include{
phase:TEST
}
}
#softmax-loss layer:输出loss值
layer{
name:"loss"
type:"SoftmaxWithLoss"
bottom:"ip1"
bottom:"label"
top:"loss"
}
#softmax layer:输出似然值(准确率)
layer{
bottom:"cls3_fc"
top:"prob"
name:"prob"
type:"Softmax"
}
其他网络配置文件:
【caffe c++】网络配置文件说明之激活函数