赞
踩
网上很多训练mnist模型的教程,但是没有将怎么测试,其实在caffe根目录输入:
:/caffe-master$ ./build/tools/caffe.bin test \
-model examples/mnist/lenet_train_test.prototxt \
-weights examples/mnist/lenet_iter_10000.caffemodel \
-iterations 100
命令行解释:
./build/tools/caffe.bin test ,表示只作预测(前向传播计算),不进行参数更新(后向传播计算)
-model examples/mnist/lenet_train_test.prototxt ,指定模型描述文本文件
-weights examples/mnist/lenet_iter_10000.caffemodel ,指定模型预先训练好的权值文件
-iterations 100 ,指定测试迭代次数,参与测试的样例数目为(iterations * batch_size),
batch_size在model prototxt 里定义,设为100时刚好覆盖10000个测试样本
以下是输出结果:
I1116 10:44:50.146291 3247 caffe.cpp:279] Use CPU.
I1116 10:44:51.683002 3247 net.cpp:322] The NetState phase (1) differed from the phase (0) specified by a rule in layer mnist //只测试I1116 10:44:51.741736 3247 data_layer.cpp:41] output data size: 100,1,28,28 //data四维数组尺寸(100,1,28,28)
I1116 10:44:51.742224 3247 net.cpp:150] Setting up mnist
I1116 10:44:51.742274 3247 net.cpp:157] Top shape: 100 1 28 28 (78400)I1116 10:44:51.742281 3247net.cpp:157] Top shape: 100 (100)
I1116 10:44:51.742300 3247 net.cpp:165] Memory required for data: 314000
I1116 10:44:51.742311 3247 layer_factory.hpp:77] Creating layer label_mnist_1_splitI1116 10:44:53.027205 3247 net.cpp:434] accuracy <- ip2_ip2_0_split_0 //兵分两路~split_0给了accuracy层
I1116 10:44:53.027211 3247 net.cpp:434] accuracy <- label_mnist_1_split_0
I1116 10:44:53.027218 3247 net.cpp:408] accuracy -> accuracyCopyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。