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

Bug when run caffe2keras #43

Open
lelechen63 opened this issue Aug 8, 2017 · 1 comment
Open

Bug when run caffe2keras #43

lelechen63 opened this issue Aug 8, 2017 · 1 comment

Comments

@lelechen63
Copy link

Hi Marc,
I run the caffe2keras function to convert resNext50, but I got the error message as error1, the x is a list instead of a keras tensor, actually it's a structure like [tensor], and if I change the keras backend code to fit this (I change the 492 as shape = x[0].get_shape()), it will get to error2, which still caused by the list type.

Best,
Lele

error1:
(keras_env) lele@istiophorus:~/visualdx_test/keras/keras/caffe$ python caffe2keras.py -load_path /home/lele/visualdx_test/code_resnext -prototxt 'template.prototxt' -caffemodel 'resnext50.caffemodel'
Using TensorFlow backend.
Converting model...
CREATING MODEL
Traceback (most recent call last):
File "caffe2keras.py", line 46, in
main(args)
File "caffe2keras.py", line 34, in main
model = convert.caffe_to_keras(args.load_path+'/'+args.prototxt, args.load_path+'/'+args.caffemodel, debug=args.debug)
File "/home/lele/visualdx_test/keras/keras/caffe/convert.py", line 53, in caffe_to_keras
debug)
File "/home/lele/visualdx_test/keras/keras/caffe/convert.py", line 369, in create_model
net_node[layer_nb] = BatchNormalization(epsilon=epsilon, axis=axis, name=name)(input_layers)
File "/home/lele/visualdx_test/keras/keras/engine/topology.py", line 596, in call
output = self.call(inputs, **kwargs)
File "/home/lele/visualdx_test/keras/keras/layers/normalization.py", line 212, in call
input_shape = K.int_shape(inputs)
File "/home/lele/visualdx_test/keras/keras/backend/tensorflow_backend.py", line 492, in int_shape
shape = x.get_shape()
AttributeError: 'list' object has no attribute 'get_shape'

error2:
(keras_env) lele@istiophorus:~/visualdx_test/keras/keras/caffe$ python caffe2keras.py -load_path /home/lele/visualdx_test/code_resnext -prototxt 'template.prototxt' -caffemodel 'resnext50.caffemodel'
Using TensorFlow backend.
Converting model...
CREATING MODEL
Traceback (most recent call last):
File "caffe2keras.py", line 46, in
main(args)
File "caffe2keras.py", line 34, in main
model = convert.caffe_to_keras(args.load_path+'/'+args.prototxt, args.load_path+'/'+args.caffemodel, debug=args.debug)
File "/home/lele/visualdx_test/keras/keras/caffe/convert.py", line 53, in caffe_to_keras
debug)
File "/home/lele/visualdx_test/keras/keras/caffe/convert.py", line 369, in create_model
net_node[layer_nb] = BatchNormalization(epsilon=epsilon, axis=axis, name=name)(input_layers)
File "/home/lele/visualdx_test/keras/keras/engine/topology.py", line 596, in call
output = self.call(inputs, **kwargs)
File "/home/lele/visualdx_test/keras/keras/layers/normalization.py", line 262, in call
epsilon=self.epsilon)
File "/home/lele/visualdx_test/keras/keras/backend/tensorflow_backend.py", line 1653, in normalize_batch_in_training
shift=None, name=None, keep_dims=False)
File "/home/lele/keras_env/local/lib/python2.7/site-packages/tensorflow/python/ops/nn_impl.py", line 634, in moments
y = math_ops.cast(x, dtypes.float32) if x.dtype == dtypes.float16 else x
AttributeError: 'list' object has no attribute 'dtype'

@hemangjethava
Copy link

Hey @lelechen63 please let me know if you have found solution of these errors!

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