Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- mean_file='../models/pretrained/imagenet_mean.binaryproto'
- if not os.path.isfile('imagenet_mean.pkl'):
- import sys
- sys.path.append('/work/04340/tushar_n/packages/caffe/python')
- import caffe
- caffe.set_device(0)
- blob = caffe.proto.caffe_pb2.BlobProto()
- data = open(mean_file,'rb').read()
- blob.ParseFromString(data)
- mean_val = np.array(caffe.io.blobproto_to_array(blob))[0] #BGR
- mean_val = mean_val[::-1,:,:] #RGB
- pickle.dump(mean_val, open('imagenet_mean.pkl','wb')) #(3,256,256)
- print 'imagenet mean np file generated'
Add Comment
Please, Sign In to add comment