jacobgil / keras-cam

Keras implementation of class activation mapping
335 stars 106 forks source link

Model Error #11

Open Eliie58 opened 6 years ago

Eliie58 commented 6 years ago

I downloaded the checkpoint from the mentioned link: https://drive.google.com/open?id=0B1l5JSkBbENBdk95ZW1DOUhqQUE

When i run the command: python cam.py --model_path cam_checkpoint.hdf5 --image_path=image.jpg

I get the following error: File "/home/user/tensorflow/local/lib/python2.7/site-packages/tensorflow/python/framework/ops.py", line 1570, in _create_c_op raise ValueError(str(e)) ValueError: Dimension 0 in both shapes must be equal, but are 3 and 64. Shapes are [3,3,5,64] and [64,3,3,3]. for 'Assign' (op: 'Assign') with input shapes: [3,3,5,64], [64,3,3,3].

The full Error is: Traceback (most recent call last): File "cam.py", line 61, in visualize_class_activation_map(args.model_path, args.image_path, args.output_path) File "cam.py", line 18, in visualize_class_activation_map model = load_model(model_path) File "/usr/local/lib/python2.7/dist-packages/keras/models.py", line 246, in load_model topology.load_weights_from_hdf5_group(f['model_weights'], model.layers) File "/usr/local/lib/python2.7/dist-packages/keras/engine/topology.py", line 3189, in load_weights_from_hdf5_group K.batch_set_value(weight_value_tuples) File "/usr/local/lib/python2.7/dist-packages/keras/backend/tensorflow_backend.py", line 2365, in batch_set_value assign_op = x.assign(assign_placeholder) File "/home/user/tensorflow/local/lib/python2.7/site-packages/tensorflow/python/ops/variables.py", line 615, in assign return state_ops.assign(self._variable, value, use_locking=use_locking) File "/home/user/tensorflow/local/lib/python2.7/site-packages/tensorflow/python/ops/state_ops.py", line 283, in assign validate_shape=validate_shape) File "/home/user/tensorflow/local/lib/python2.7/site-packages/tensorflow/python/ops/gen_state_ops.py", line 60, in assign use_locking=use_locking, name=name) File "/home/user/tensorflow/local/lib/python2.7/site-packages/tensorflow/python/framework/op_def_library.py", line 787, in _apply_op_helper op_def=op_def) File "/home/user/tensorflow/local/lib/python2.7/site-packages/tensorflow/python/framework/ops.py", line 3392, in create_op op_def=op_def) File "/home/user/tensorflow/local/lib/python2.7/site-packages/tensorflow/python/framework/ops.py", line 1734, in init control_input_ops) File "/home/user/tensorflow/local/lib/python2.7/site-packages/tensorflow/python/framework/ops.py", line 1570, in _create_c_op raise ValueError(str(e)) ValueError: Dimension 0 in both shapes must be equal, but are 3 and 64. Shapes are [3,3,5,64] and [64,3,3,3]. for 'Assign' (op: 'Assign') with input shapes: [3,3,5,64], [64,3,3,3].

Any idea why is this happening?

95xueqian commented 5 years ago

i hava the same problem whith you, did you solve it?

Jeralyn123 commented 5 years ago

i aslo hava the same problem whith you, did you solve it?

farm365 commented 5 years ago

god,i have the same error,anybody got the answer?

meghana30 commented 5 years ago

You need to run the command like below: python cam.py --model_path=cam_checkpoint.hdf5 --image_path= --output_path=test.jpg

jspir1t commented 5 years ago

I run the command like you said, problems still occur

matak07 commented 4 years ago

@meghana30 I tried the command your way but still getting the same error. Did anyone get any solution?