ethereon / caffe-tensorflow

Caffe models in TensorFlow
Other
2.8k stars 1.04k forks source link

google.protobuf.text_format.ParseError: 1:1 : Message type "caffe.NetParameter" has no field named "net". #158

Open ghost opened 6 years ago

ghost commented 6 years ago

Hello,

I am new to deep learning and programming. For a project I needed to convert some pre trained nets in caffe to tensorflow.

When I attempt converting any file (including out-of-the-box caffe models) by running ~/caffe-tensorflow/convert.py solver.prototxt --caffemodel bvlc_reference_caffenet.caffemodel --data-output-path=conversion.npy

It gives me the following output:

/usr/local/lib/python2.7/dist-packages/h5py/__init__.py:36: FutureWarning: Conversion of the second argument of issubdtype fromfloattonp.floatingis deprecated. In future, it will be treated asnp.float64 == np.dtype(float).type. from ._conv import register_converters as _register_converters Traceback (most recent call last): File "/home/luis/Documents/PhD/DeepLearning/caffe-tensorflow/convert.py", line 68, in <module> main() File "/home/luis/Documents/PhD/DeepLearning/caffe-tensorflow/convert.py", line 64, in main args.phase) File "/home/luis/Documents/PhD/DeepLearning/caffe-tensorflow/convert.py", line 27, in convert transformer = TensorFlowTransformer(def_path, caffemodel_path, phase=phase) File "/home/luis/Documents/PhD/DeepLearning/caffe-tensorflow/kaffe/tensorflow/transformer.py", line 221, in __init__ self.load(def_path, data_path, phase) File "/home/luis/Documents/PhD/DeepLearning/caffe-tensorflow/kaffe/tensorflow/transformer.py", line 227, in load graph = GraphBuilder(def_path, phase).build() File "/home/luis/Documents/PhD/DeepLearning/caffe-tensorflow/kaffe/graph.py", line 140, in __init__ self.load() File "/home/luis/Documents/PhD/DeepLearning/caffe-tensorflow/kaffe/graph.py", line 146, in load text_format.Merge(def_file.read(), self.params) File "/home/luis/.virtualenvs/tensorflowCUDA/lib/python2.7/site-packages/google/protobuf/text_format.py", line 533, in Merge descriptor_pool=descriptor_pool) File "/home/luis/.virtualenvs/tensorflowCUDA/lib/python2.7/site-packages/google/protobuf/text_format.py", line 587, in MergeLines return parser.MergeLines(lines, message) File "/home/luis/.virtualenvs/tensorflowCUDA/lib/python2.7/site-packages/google/protobuf/text_format.py", line 620, in MergeLines self._ParseOrMerge(lines, message) File "/home/luis/.virtualenvs/tensorflowCUDA/lib/python2.7/site-packages/google/protobuf/text_format.py", line 635, in _ParseOrMerge self._MergeField(tokenizer, message) File "/home/luis/.virtualenvs/tensorflowCUDA/lib/python2.7/site-packages/google/protobuf/text_format.py", line 703, in _MergeField (message_descriptor.full_name, name)) google.protobuf.text_format.ParseError: 1:1 : Message type "caffe.NetParameter" has no field named "net".

I have Ubuntu 16.04, python 2.7 and installed tensorflow in a virtualenv. I installed pycaffe and also renamed caffepb.py to caffe_pb2.py according to https://github.com/ethereon/caffe-tensorflow/issues/114

I am also trying to make something analogus to https://github.com/ethereon/caffe-tensorflow/issues/118 but still have not found what to change exaclty.

Thanks in advance for your help!

yangsu9304 commented 5 years ago

I guess you missed the first letter in the *.prototxt, when you copied.