使用caffemodel的方法

原文地址:http://www.bubuko.com/infodetail-867723.html

感谢博主lynnandwei,写的博客,因为看了它写的博客,我才知道在Linux下面,如何调用caffe已经训练好的模型进行测试。也为后续必要的很多操作提供了思路。

使用caffemodel的方法_第1张图片

如上图 ,就是build/tools/caffe.bin文件,上图就有它的指令介绍。

在MNIST调用已经训练好的模型,测试。

这个测试,假定可能是新加入的测试集,还是按照原来的需求转换,存放数据到指定的位置。

./build/tools/caffe.bin test -model=examples/mnist/lenet_train_test.prototxt -weights=examples/mnist/lenet_iter_10000.caffemodel -gpu=0 

如果没有GPU则使用

./build/tools/caffe.bin test -model=examples/mnist/lenet_train_test.prototxt -weights=examples/mnist/lenet_iter_10000.caffemodel

从上面的指令,对应上图。

1、先是test表明是要评价一个已经训练好的模型。

2、然后指定模型prototxt文件,这是一个文本文件,详细描述了网络结构和数据集信息。从mnist下面的train_lenet.sh指定的solver对应于examples/mnist/lenet_solver.prototxt,而lenet_solver.prototxt指定的模型为examples/mnist/lenet_train_test.prototxt。

3、然后在指定模型的具体的权重。刚好为examples/mnist/lenet_iter_10000.caffemodel

在cifar10模型下面调用已经训练好的模型,测试。

同上,是用train_quick.sh训练的。

./build/tools/caffe.bin test -model=examples/cifar10/cifar10_quick_train_test.prototxt -weights=examples/cifar10/cifar10_quick_iter_5000.caffemodel -gpu=0

1、先是test表明是要评价一个已经训练好的模型。

2、然后指定模型prototxt文件,这是一个文本文件,详细描述了网络结构和数据集信息。从cifar下面的train_quick.sh指定的solver对应于开始的examples/mnist/lenet_solver.prototxt和4000次以后snapshot的examples/cifar10/cifar10_quick_solver_lr1.prototxt,而这两者指定的模型都为cifar10_quick_train_test.prototxt。

3、然后在指定模型的具体的权重。为examples/cifar10/cifar10_quick_iter_5000.caffemodel

caffe调用已生成的模型,测试(Linux)


你可能感兴趣的:(caffe)