Created
November 29, 2016 19:42
-
-
Save DEKHTIARJonathan/00fbfc371f7370dfdb63377a16ae2965 to your computer and use it in GitHub Desktop.
python convert_protomean.py proto.mean out.npy
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
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( sys.argv[1] , 'rb' ).read() | |
blob.ParseFromString(data) | |
arr = np.array( caffe.io.blobproto_to_array(blob) ) | |
out = arr[0] | |
np.save( sys.argv[2] , out ) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment