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

the "pad" param is float which unaccept in caffe #5

Open
ireqhawk opened this issue Jun 29, 2018 · 8 comments
Open

the "pad" param is float which unaccept in caffe #5

ireqhawk opened this issue Jun 29, 2018 · 8 comments

Comments

@ireqhawk
Copy link

hello uhfband,thanks for your work.when i run the convert_VGG16 demo,i got the error:
File "/media/ireqhawk/文件/ireqhawk/project/AdienceDBClassfi/AdienceDBClassfi/demo.py", line 184, in <module> main() File "/media/ireqhawk/文件/ireqhawk/project/AdienceDBClassfi/AdienceDBClassfi/demo.py", line 147, in main keras2caffe.convert(keras_model, 'VGG16.prototxt', 'VGG16.caffemodel') File "/media/ireqhawk/文件/ireqhawk/project/AdienceDBClassfi/AdienceDBClassfi/keras2caffe/convert.py", line 375, in convert net_proto = input_str + '\n' + 'layer {' + 'layer {'.join(str(caffe_net.to_proto()).split('layer {')[2:]) File "/home/ireqhawk/bin/caffe/python/caffe/net_spec.py", line 193, in to_proto top._to_proto(layers, names, autonames) File "/home/ireqhawk/bin/caffe/python/caffe/net_spec.py", line 96, in _to_proto return self.fn._to_proto(layers, names, autonames) File "/home/ireqhawk/bin/caffe/python/caffe/net_spec.py", line 159, in _to_proto _param_names[self.type_name] + '_param'), k, v) File "/home/ireqhawk/bin/caffe/python/caffe/net_spec.py", line 73, in assign_proto getattr(proto, name).extend(val) TypeError: 1.5 has type float, but expected one of: int, long
it becuase the convert code cal a float "pad" param,if i just fllor the pad val,i will got uneuqal shape on save caffemodel,any advise.
my enviroment:
caffe 1.0.0
keras 2.1.2
tensorflow 1.4.1

thank you!

@uhfband
Copy link
Owner

uhfband commented Jun 29, 2018

Hi!
How do you create keras model in your code? What input shape?
e.g keras_model = VGG16(input_shape=(224, 224, 3), weights='imagenet', include_top=True)

@ireqhawk
Copy link
Author

ireqhawk commented Jul 4, 2018

i create a wide residual net,with depth 16,width 8,except the "pad" param,i find it will be some problem in average_pooling2d layer,it is signed in this project's readme file,so i delete the average_pooling2d layer.but when convert the weights to caffemodel file,some layer get unsuitable shape.i could not find why.
i wonder maybe i misunderstanding this project?maybe is just be workful in the examle nets?
thanks for your help!

@uhfband
Copy link
Owner

uhfband commented Jul 6, 2018

What is kernel size, stride, input and output shape in your average_pooling2d layer?

@marianogaragiola
Copy link

Hi, I'm having the same problem with a keras squeezenet, any idea on how to solve it?

@uhfband
Copy link
Owner

uhfband commented Aug 6, 2018

@marianogaragiola, what implementation of Squeezenet are you using?

@marianogaragiola
Copy link

marianogaragiola commented Aug 6, 2018

Is the keras_squeezenet version. I solved the problem casting to int the value of the variable, seems to working fine but I'm not so sure is the correct way to do it.

@uhfband
Copy link
Owner

uhfband commented Aug 9, 2018

@marianogaragiola I had modified the padding calculation, it should work properly now

@marianogaragiola
Copy link

Ok, thanks. I will use the new version and test it.

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

3 participants