0
我有brainwash_mean.npy
文件,这是一个没有错误的正确文件。'数组形状不正确。'从npy转换为binaryproto时出错
我想转换npy file to binaryproto
和我有'Incorrect array shape.'
错误。
我的代码是
def convert_numpy_binaryproto(filename):
print filename;
avg_img = np.load(filename);
#avg_img is your numpy array with the average data
blob = caffe.io.array_to_blobproto(avg_img);
with open(mean.binaryproto, 'wb') as f :
f.write(blob.SerializeToString())
def main(argv):
convert_numpy_binaryproto(sys.argv[1]);
if __name__ == "__main__":
main(sys.argv[1:])
出了什么问题?