ValueError: Dimension 1 in both shapes must be equal, but are 0 and 100 for 'Assign_320' (op: 'Assign') with input shapes: [2048,0], [2048,100].
w5688414 opened this issue · 0 comments
w5688414 commented
/home/deeplearning/下载/baidu_dogs/keras-transfer-learning-for-oxford102/models/resnet50.py:32: UserWarning: Update your `Model` call to the Keras 2 API: `Model(outputs=Tensor("pr..., inputs=Tensor("in...)`
self.model = Model(input=base_model.input, output=predictions)
Traceback (most recent call last):
File "/home/deeplearning/下载/pycharm-community-2017.1.4/helpers/pydev/pydevd.py", line 1591, in <module>
globals = debugger.run(setup['file'], None, None, is_module)
File "/home/deeplearning/下载/pycharm-community-2017.1.4/helpers/pydev/pydevd.py", line 1018, in run
pydev_imports.execfile(file, globals, locals) # execute the script
File "/home/deeplearning/下载/baidu_dogs/keras-transfer-learning-for-oxford102/predict.py", line 144, in <module>
model = model_module.load()
File "/home/deeplearning/下载/baidu_dogs/keras-transfer-learning-for-oxford102/models/base_model.py", line 58, in load
self.model.load_weights(config.get_fine_tuned_weights_path())
File "/home/deeplearning/.local/lib/python2.7/site-packages/keras/engine/topology.py", line 2572, in load_weights
load_weights_from_hdf5_group(f, self.layers)
File "/home/deeplearning/.local/lib/python2.7/site-packages/keras/engine/topology.py", line 3008, in load_weights_from_hdf5_group
K.batch_set_value(weight_value_tuples)
File "/home/deeplearning/.local/lib/python2.7/site-packages/keras/backend/tensorflow_backend.py", line 2184, in batch_set_value
assign_op = x.assign(assign_placeholder)
File "/home/deeplearning/.local/lib/python2.7/site-packages/tensorflow/python/ops/variables.py", line 516, in assign
return state_ops.assign(self._variable, value, use_locking=use_locking)
File "/home/deeplearning/.local/lib/python2.7/site-packages/tensorflow/python/ops/state_ops.py", line 271, in assign
validate_shape=validate_shape)
File "/home/deeplearning/.local/lib/python2.7/site-packages/tensorflow/python/ops/gen_state_ops.py", line 45, in assign
use_locking=use_locking, name=name)
File "/home/deeplearning/.local/lib/python2.7/site-packages/tensorflow/python/framework/op_def_library.py", line 767, in apply_op
op_def=op_def)
File "/home/deeplearning/.local/lib/python2.7/site-packages/tensorflow/python/framework/ops.py", line 2508, in create_op
set_shapes_for_outputs(ret)
File "/home/deeplearning/.local/lib/python2.7/site-packages/tensorflow/python/framework/ops.py", line 1873, in set_shapes_for_outputs
shapes = shape_func(op)
File "/home/deeplearning/.local/lib/python2.7/site-packages/tensorflow/python/framework/ops.py", line 1823, in call_with_requiring
return call_cpp_shape_fn(op, require_shape_fn=True)
File "/home/deeplearning/.local/lib/python2.7/site-packages/tensorflow/python/framework/common_shapes.py", line 610, in call_cpp_shape_fn
debug_python_shape_fn, require_shape_fn)
File "/home/deeplearning/.local/lib/python2.7/site-packages/tensorflow/python/framework/common_shapes.py", line 676, in _call_cpp_shape_fn_impl
raise ValueError(err.message)
ValueError: Dimension 1 in both shapes must be equal, but are 0 and 100 for 'Assign_320' (op: 'Assign') with input shapes: [2048,0], [2048,100].
I have modified the code with the tf backend and change the inputshape to fit it, but when I wanted to predit the classes using the predict.py, I got the error, can anyone help me?
I didn't change any code in predict.py