在caffe训练的过程中,我们利用验证集来测试,可以大概了解模型的准确率。
本文讲解的是,对于caffe训练好的模型进行预测,得出准确率。
主要需要以下几个文件:
其中log文件夹保存的是测试结果
snapshot_iter_50000.caffemodel.h5: 为需要测试的caffe模型
test.sh: 为测试程序
train_val.prototxt: 为测试的网络结构,需要加入测试数据。
test.sh:
#!/usr/bin/env sh
TOOLS=/caffe-master/build/tools
GLOG_log_dir='/celeba_test/log/' \
$TOOLS/caffe test \
--model=/celeba_test/train_val.prototxt \
--weights=/celeba_test/snapshot_iter_50000.caffemodel.h5 \
--iterations=320 \
--gpu=0
其中 iterations * batch_size = 测试图片总数,