Hi,
I'm trying to test
my data with a trained net, using the deploy.prototxt file, in Python.
I'm loading the images from the original files and I want to use the mean.binaryproto file. However it's giving me a error and I don't know how to solve this.
net = caffe.Net(examples_folder + '/test_deploy.prototxt',
examples_folder + '/net_iter_10000.caffemodel',
caffe.TEST)
blob = caffe.proto.caffe_pb2.BlobProto()
data = open(MEAN_FILE , 'rb').read()
blob.ParseFromString(data)
mean_arr = caffe.io.blobproto_to_array(blob)
transformer = caffe.io.Transformer({'data': net.blobs['data'].data.shape})
image = caffe.io.load_image(caffe_root + 'data/' + data_folder + '/val/' + img_filenames[i][0],color=False)
transformer.set_mean('data', mean_arr[0][0])
transformer.set_raw_scale('data', 255)
transformed_image = transformer.preprocess('data', image)
net.blobs['data'].data[i] = transformed_image
mean_arr[0][0] has the shape (64,64)
Traceback (most recent call last):
File "readcaffemodel_withmean.py", line 131, in <module>
write_test_results()
File "readcaffemodel_withmean.py", line 109, in write_test_results
transformed_image = transformer.preprocess('data', image)
File "../python/caffe/io.py", line 158, in preprocess
caffe_in -= mean
ValueError: non-broadcastable output operand with shape (64,64,1) doesn't match the broadcast shape (64,64,64)
Thank you in advance.