titu1994 / Image-Super-Resolution

Implementation of Super Resolution CNN in Keras.
832 stars 269 forks source link

ValueError #26

Open Kazusasukina opened 6 years ago

Kazusasukina commented 6 years ago

$ python main.py "C:\Users\Kazusasukina\PycharmProjects\Image-Super-Resolution-master\results\lenna.bmp" --model=ddsr D:\environment\python\python35\lib\site-packages\h5py__init.py:36: FutureWarning: Conversion of the second argument of issubdtype from float to np.floating is deprecated. In future, it will be treated as np.float64 == np.dtype(float).type. from ._conv import register_converters as _register_converters Using TensorFlow backend. Old Size : (512, 512, 3) New Size : (1024, 1024, 3) Number of patches = 1034289, Patch Shape = (8, 8) Saving intermediate image. Traceback (most recent call last): File "D:\environment\python\python35\lib\site-packages\tensorflow\python\framework\common_shapes.py", line 686, in _call_cpp_shape_fn_impl input_tensors_as_shapes, status) File "D:\environment\python\python35\lib\site-packages\tensorflow\python\framework\errors_impl.py", line 473, in exit__ c_api.TF_GetCode(self.status.status)) tensorflow.python.framework.errors_impl.InvalidArgumentError: Dimension 2 in both shapes must be equal, but are 3 and 64 for 'Assign' (op: 'Assign') with input shapes: [3,3,3,64], [3,3,64,3].

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "main.py", line 57, in model.upscale(p, save_intermediate=save, mode=mode, patch_size=patch_size, suffix=suffix) File "C:\Users\Kazusasukina\PycharmProjects\Image-Super-Resolution-master\models.py", line 202, in upscale model = self.create_model(img_dim_2, img_dim_1, load_weights=True) File "C:\Users\Kazusasukina\PycharmProjects\Image-Super-Resolution-master\models.py", line 659, in create_model if load_weights: model.load_weights(self.weight_path) File "D:\environment\python\python35\lib\site-packages\keras\engine\topology.py", line 2656, in load_weights f, self.layers, reshape=reshape) File "D:\environment\python\python35\lib\site-packages\keras\engine\topology.py", line 3382, in load_weights_from_hdf5_group K.batch_set_value(weight_value_tuples) File "D:\environment\python\python35\lib\site-packages\keras\backend\tensorflow_backend.py", line 2368, in batch_set_value assign_op = x.assign(assign_placeholder) File "D:\environment\python\python35\lib\site-packages\tensorflow\python\ops\variables.py", line 573, in assign return state_ops.assign(self._variable, value, use_locking=use_locking) File "D:\environment\python\python35\lib\site-packages\tensorflow\python\ops\state_ops.py", line 276, in assign validate_shape=validate_shape) File "D:\environment\python\python35\lib\site-packages\tensorflow\python\ops\gen_state_ops.py", line 56, in assign use_locking=use_locking, name=name) File "D:\environment\python\python35\lib\site-packages\tensorflow\python\framework\op_def_library.py", line 787, in _apply_op_helper op_def=op_def) File "D:\environment\python\python35\lib\site-packages\tensorflow\python\framework\ops.py", line 2958, in create_op set_shapes_for_outputs(ret) File "D:\environment\python\python35\lib\site-packages\tensorflow\python\framework\ops.py", line 2209, in set_shapes_for_outputs shapes = shape_func(op) File "D:\environment\python\python35\lib\site-packages\tensorflow\python\framework\ops.py", line 2159, in call_with_requiring return call_cpp_shape_fn(op, require_shape_fn=True) File "D:\environment\python\python35\lib\site-packages\tensorflow\python\framework\common_shapes.py", line 627, in call_cpp_shape_fn require_shape_fn) File "D:\environment\python\python35\lib\site-packages\tensorflow\python\framework\common_shapes.py", line 691, in _call_cpp_shape_fn_impl raise ValueError(err.message) ValueError: Dimension 2 in both shapes must be equal, but are 3 and 64 for 'Assign' (op: 'Assign') with input shapes: [3,3,3,64], [3,3,64,3].

I came across this problem and had no idea about how to figure this out @titu1994 ,may you help~ thanks

Combo819 commented 6 years ago

I have the same problem when using model "sr","esr","dsr"and"ddsr". Have you figured this out yet? Thank you~ @Kazusasukina

JeffSaa commented 5 years ago

I had the same issue. I fix it downgrading keras to 2.2.4 and tensorflow to 1.14.0

yunkchen commented 4 years ago

@JeffSaa Keras 2.2.4 and Tensorflow 1.14.0 but didn't work.