I need to convert the attached binaryproto to a MATLAB readable format.
I am not a python/caffe user yet but trying to be one soon. I have an urgency. Would any of you be kind convert the attached binaryproto to a mat file. I think the below code is sufficient.
caffe_root = '/.../' # this file is expected to be in {caffe_root}/examples
import sys
sys.path.insert(0, caffe_root + 'python')
import caffe
import numpy as np
import sys
if len(sys.argv) != 3:
print "Usage: python convert_protomean.py proto.mean out.npy"
sys.exit()
blob = caffe.proto.caffe_pb2.BlobProto()
data = open( '/.../mean.binaryproto', 'rb' ).read()
blob.ParseFromString(data)
arr = np.array( caffe.io.blobproto_to_array(blob) )
out = arr[0]
np.save('/.../mean' , out ) #first,save it to *.npy,then convert it to *.mat
data=np.load('/.../mean.npy')
sio.savemat('/.../data_mean.mat',{'data':data})