使用预先训练的Caffe模型进行测试,准确度低于训练时的测试阶段

时间:2017-10-23 13:03:12

标签: machine-learning neural-network computer-vision deep-learning caffe

我在Caffe训练了一个ResNet-50模型。当我使用Caffe的Python界面逐个测试图像时,在训练模型时,准确度低于测试阶段。
也就是说,当我将图像更改为LMDB格式,并在命令行中使用预先训练的模型进行测试时,精度高于我逐个测试图像。

基本的Python代码:

net = caffe.Net('Resnet-50-deploy.prototxt', 'resnet_50_600000.caffemodel', caffe.TEST)
transformer = caffe.io.Transformer({'data': net.blobs['data'].data.shape})
transformer.set_transpose('data', (2, 0, 1))
transformer.set_raw_scale('data', 255)
#imagepath is from a while loop
image = caffe.io.load_image(imagepath)
transformed_img = transformer.preprocess('data', image)
net.blobs['data'].data[...] = transformed_img
output = net.forward()

为什么准确度不同?我确信图像是一样的。

0 个答案:

没有答案