caffe:使用训练好的模型

来源:互联网 发布:监控设备搜索软件 编辑:程序博客网 时间:2024/04/30 18:33

1、 均值文件
将所有训练样本的均值保存为文件
图片减去均值后,再进行训练和测试,会提高速度和精度
运行方法:(使用Caffe工具)
compute_image_mean [train_lmdb] [mean.binaryproto]
2、 改写deploy文件
a. 把数据层(Data Layer)和连接数据层的Layers去掉(即top:data的层)
b. 去掉输出层和连接输出层的Layers(即bottom:label)
c. 重新建立输入
input: “data”
input_shape {
dim: 1 # batchsize,每次forward的时候输入的图片个数
dim: 3 # number of colour channels - rgb
dim: 28 # width
dim: 28 # height
}
d . 重新建立输出
* 修改后的mnist的deploy文件可以参考caffe/example/mnist/lenet_train.prototxt
layer {
name: “prob”
type: “Softmax”
bottom: “ip2”
top: “prob”
}
f. 使用修改后的mnist的deploy文件,输入一张图片,输出分类结果
3、 实际演示
4、 使用fine turning微调网络

阅读全文
1 0
原创粉丝点击