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

DenseNet Pretrained Weight conversion #112

Open
ahundt opened this issue Apr 25, 2017 · 2 comments
Open

DenseNet Pretrained Weight conversion #112

ahundt opened this issue Apr 25, 2017 · 2 comments

Comments

@ahundt
Copy link

ahundt commented Apr 25, 2017

I'm interested in converting the pretrained weights of DenseNet.

I adapted the instructions at:
https://github.com/nicolov/segmentation_keras/tree/master/conversion

However this runs into the following problem:

± sudo docker run -v `pwd`:/workspace -ti `docker build -q .`
Traceback (most recent call last):
  File "./convert.py", line 60, in <module>
    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 "/workspace/caffe-tensorflow/kaffe/tensorflow/transformer.py", line 221, in __init__
    self.load(def_path, data_path, phase)
  File "/workspace/caffe-tensorflow/kaffe/tensorflow/transformer.py", line 227, in load
    graph = GraphBuilder(def_path, phase).build()
  File "/workspace/caffe-tensorflow/kaffe/graph.py", line 140, in __init__
    self.load()
  File "/workspace/caffe-tensorflow/kaffe/graph.py", line 146, in load
    text_format.Merge(def_file.read(), self.params)
  File "/usr/local/lib/python2.7/dist-packages/google/protobuf/text_format.py", line 476, in Merge
    descriptor_pool=descriptor_pool)
  File "/usr/local/lib/python2.7/dist-packages/google/protobuf/text_format.py", line 526, in MergeLines
    return parser.MergeLines(lines, message)
  File "/usr/local/lib/python2.7/dist-packages/google/protobuf/text_format.py", line 559, in MergeLines
    self._ParseOrMerge(lines, message)
  File "/usr/local/lib/python2.7/dist-packages/google/protobuf/text_format.py", line 574, in _ParseOrMerge
    self._MergeField(tokenizer, message)
  File "/usr/local/lib/python2.7/dist-packages/google/protobuf/text_format.py", line 675, in _MergeField
    merger(tokenizer, message, field)
  File "/usr/local/lib/python2.7/dist-packages/google/protobuf/text_format.py", line 764, in _MergeMessageField
    self._MergeField(tokenizer, sub_message)
  File "/usr/local/lib/python2.7/dist-packages/google/protobuf/text_format.py", line 675, in _MergeField
    merger(tokenizer, message, field)
  File "/usr/local/lib/python2.7/dist-packages/google/protobuf/text_format.py", line 764, in _MergeMessageField
    self._MergeField(tokenizer, sub_message)
  File "/usr/local/lib/python2.7/dist-packages/google/protobuf/text_format.py", line 643, in _MergeField
    (message_descriptor.full_name, name))
google.protobuf.text_format.ParseError: 54:5 : Message type "caffe.PoolingParameter" has no field named "ceil_mode".

Which is due to the ceil_mode param as per shicai/DenseNet-Caffe#1 which requires this caffe pull request https://github.com/BVLC/caffe/pull/3057/files

@flyyufelix
Copy link

You have to manually add ceil mode to caffe. See this commit:

https://github.com/BVLC/caffe/pull/3057/files

Then you have to recompile Caffe and use the caffe_pb2.py (located at python/caffe/proto) to read protobuf content (i.e. caffemodel) with python.

@ahundt
Copy link
Author

ahundt commented Jul 4, 2017

Oh because the dockerfile will not check out the version with ceil mode support... how tricky! I wonder why they don't merge that PR it has been there for ages. :-/

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