.caffemodel的生成和利用

来源:互联网 发布:网络算法与复杂性理论 编辑:程序博客网 时间:2024/06/06 14:03

1)调用solver.prototxt生成.caffemodel和.solverstate

     caffe中的bin文件夹里有caffe.exe,在上级目录中创建.bat文件,添加内容并保存运行:

     ./bin/caffe.exe train --solver=examples/cifar10/cifar10_quick_solver.prototxtpause

      然后就会在examples/cifar10/文件夹中,训练出.caffemodel和.solverstate文件,其中.caffemodel用于测试,.solverstate用于恢复训练(像断点续            传)

2)当所有数据都训练好之后,接下来就是如何将模型应用到实际数据了:

./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


test:表示对训练好的模型进行Testing,而不是training。其他参数包括train, time, device_query。

-model=XXX:指定模型prototxt文件,这是一个文本文件,详细描述了网络结构和数据集信息

0 1
原创粉丝点击