Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

convert.py ran failed with "Enum type has no value named Convolution" #44

Closed
zsyet opened this issue Jul 4, 2016 · 2 comments
Closed

Comments

@zsyet
Copy link

zsyet commented Jul 4, 2016

i've installed the latest caffe-master
i'm trying to convert the follow 2 file to tensorflow model
https://gist.githubusercontent.com/ksimonyan/211839e770f7b538e2d8/raw/0067c9b32f60362c74f4c445a080beed06b07eb3/VGG_ILSVRC_16_layers_deploy.prototxt
http://www.robots.ox.ac.uk/~vgg/software/very_deep/caffe/VGG_ILSVRC_16_layers.caffemodel

the first time i tried, convert.py raised the error "Error encountered: Unknown layer type encountered: 4"
it's because the layer type name defined kaffe\layer.py is not extactly the same with those referred by VGG_ILSVRC_16_layers_deploy.prototxt
i modified the capital layer name in VGG_ILSVRC_16_layers_deploy.prototxt, then ran convert.py again

this time it raised the error Enum type "caffe.V1LayerParameter.LayerType" has no value named Convolution, the following the full message:
(tf-0.8.0-gpu-py27)dl@dl123:~/mxnet-org-bai/tools/caffe-tensorflow-master$ python convert.py --caffemodel VGG_ILSVRC_16_layers.caffemodel --data-output-path tfout.data --code-output-path tfout.code VGG_ILSVRC_16_layers_deploy.prototxt-bak-new
I tensorflow/stream_executor/dso_loader.cc:105] successfully opened CUDA library libcublas.so locally
I tensorflow/stream_executor/dso_loader.cc:105] successfully opened CUDA library libcudnn.so locally
I tensorflow/stream_executor/dso_loader.cc:105] successfully opened CUDA library libcufft.so locally
I tensorflow/stream_executor/dso_loader.cc:105] successfully opened CUDA library libcuda.so.1 locally
I tensorflow/stream_executor/dso_loader.cc:105] successfully opened CUDA library libcurand.so locally


WARNING: PyCaffe not found!
Falling back to a pure protocol buffer implementation.
* Conversions will be drastically slower.
* This backend is UNTESTED!

Traceback (most recent call last):
File "convert.py", line 60, in
main()
File "convert.py", line 56, in main
args.phase)
File "convert.py", line 27, in convert
transformer = TensorFlowTransformer(def_path, caffemodel_path, phase=phase)
File "/home/dl/mxnet-org-bai/tools/caffe-tensorflow-master/kaffe/tensorflow/transformer.py", line 221, in init
self.load(def_path, data_path, phase)
File "/home/dl/mxnet-org-bai/tools/caffe-tensorflow-master/kaffe/tensorflow/transformer.py", line 227, in load
graph = GraphBuilder(def_path, phase).build()
File "/home/dl/mxnet-org-bai/tools/caffe-tensorflow-master/kaffe/graph.py", line 140, in init
self.load()
File "/home/dl/mxnet-org-bai/tools/caffe-tensorflow-master/kaffe/graph.py", line 146, in load
text_format.Merge(def_file.read(), self.params)
File "/home/dl/anaconda2/envs/tf-0.8.0-gpu-py27/lib/python2.7/site-packages/google/protobuf/text_format.py", line 309, in Merge
return MergeLines(text.split('\n'), message, allow_unknown_extension)
File "/home/dl/anaconda2/envs/tf-0.8.0-gpu-py27/lib/python2.7/site-packages/google/protobuf/text_format.py", line 346, in MergeLines
_ParseOrMerge(lines, message, True, allow_unknown_extension)
File "/home/dl/anaconda2/envs/tf-0.8.0-gpu-py27/lib/python2.7/site-packages/google/protobuf/text_format.py", line 371, in _ParseOrMerge
allow_unknown_extension)
File "/home/dl/anaconda2/envs/tf-0.8.0-gpu-py27/lib/python2.7/site-packages/google/protobuf/text_format.py", line 473, in _MergeField
allow_unknown_extension)
File "/home/dl/anaconda2/envs/tf-0.8.0-gpu-py27/lib/python2.7/site-packages/google/protobuf/text_format.py", line 493, in _MergeField
_MergeScalarField(tokenizer, message, field, allow_multiple_scalars)
File "/home/dl/anaconda2/envs/tf-0.8.0-gpu-py27/lib/python2.7/site-packages/google/protobuf/text_format.py", line 629, in _MergeScalarField
value = tokenizer.ConsumeEnum(field)
File "/home/dl/anaconda2/envs/tf-0.8.0-gpu-py27/lib/python2.7/site-packages/google/protobuf/text_format.py", line 951, in ConsumeEnum
raise self._ParseError(str(e))
google.protobuf.text_format.ParseError: 11:9 : Enum type "caffe.V1LayerParameter.LayerType" has no value named Convolution.

@ethereon
Copy link
Owner

ethereon commented Jul 4, 2016

You'll need to update the prototxt and caffemodel files to the latest version, as described in the notes section of the README. See also: #39

@zsyet
Copy link
Author

zsyet commented Jul 11, 2016

i've updated them to the latest version by running the upgrade_net_proto_text and upgrade_net_proto_binary, and it worked well, thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants