在Python中未安装Caffe的情况下从.caffemodel提取权重 [英] Extracting weights from .caffemodel without caffe installed in Python
问题描述
有没有一种相对简单的方法可以从Caffe Zoo WITHOUT CAFFE (也称为pyCaffe)中许多预训练的模型之一中提取Python中的权重?即将.caffemodel
解析为hdf5/numpy或Python可以读取的任何格式?
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 .caffemodel
to hdf5/numpy or whatever format that can be read by Python?
我发现的所有答案都将C ++代码与caffe类或Pycaffe一起使用. 我看过pycaffe的代码,看来您真的需要caffe来理解二进制文件,这是唯一的解决方案吗?
All the answers I found use C++ code with caffe classes or Pycaffe. I have looked at pycaffe's code it looks like you really need caffe to make sense of the binary is that the only solution?
推荐答案
As it so happens, ethereon made a wonderful library called caffe-tensorflow to convert caffe models to Tensorflow code, but that is not all! It also allows the user to convert .caffemodel
files to .npy
files without having to build pycaffe! It tests if caffe was built and if not it falls back to a pure google protobuf implementation.
这篇关于在Python中未安装Caffe的情况下从.caffemodel提取权重的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!