Created
July 11, 2016 03:29
-
-
Save mpkuse/e156e54d20bd2389394e69b0f3df7cf6 to your computer and use it in GitHub Desktop.
.binaryproto of caffe to numpy array
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Converts the mean.binaryproto (mean image) to a numpy image. | |
import caffe | |
import numpy as np | |
import sys | |
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 ) | |
im = out.transpose(1,2,0) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment