I want to use python to parse .caffemodel binary proto.
For the mean file, the following code works well:
f = open('data/ilsvrc12/imagenet_mean.binaryproto','rb')
blob = caffe_pb2.BlobProto()
blob.ParseFromString(f.read())
f.close()
print blob.ByteSize()
print blob.height, blob.width,blob.channels, blob.num
f = open(dstmodel,'wb')
f.write(blob.SerializeToString())
f.close()
print 'Done.'
Outputs:
But when I use the same code to parse caffemodel
f = open('models/bvlc_reference_caffenet/bvlc_reference_caffenet.caffemodel','rb')
# ...
# other code lines are the same
# ...
Outputs:
Oops, the byte size is correct, but all data are 0/empty.
Any guy know about this?
Thanks,