Is there a relatively simple way to extract weights in Python from one of the many pretrained models in Caffe Zoo WITHOUT CAFFE (nor pyCaffe)? i.e. parsing .caffe
Nowadays, caffe can save the weights in two formats: BINARYPROTO, or HDF5. Binary weights files with extension .caffemodel
are in BINARYPROTO format, while extension .caffemodel.h5
are in HDF5 format. Since the HDF5 format was introduced to caffe recently, I expect most models you currently encounter in the "model zoo" to be in the more "traditional" BINARYPROTO format.
If the weights are in stored in HDF5 format, you might be able to pick through them using h5py
package.
However, the BINARYPROTO format is based on a binary serialization of google protocol buffer format that is defined by caffe.proto. I am no expert in protocol buffers, but I suspect you will have a really hard time deciphering the binary file without explicitly "compiling" the caffe.proto
protobuf definition files (which is part of caffe build).
I suppose the easiest way to pick into the weights is by installing caffe and using its python/C++ interface. Why don't you just do that?