rajatkb / RDNSR-Residual-Dense-Network-for-Super-Resolution-Keras

Residual Dense Network for Super Resolution implementation in Keras
Apache License 2.0
16 stars 8 forks source link

error in the 164th line during testing with the pretrained weights. #3

Open chennuriprateek opened 4 years ago

chennuriprateek commented 4 years ago

The ran the line "python main.py --test_only True --gpu 1 --chk 160 --scale 2 --test_image bsds_test2.jpg" in the terminal.

Error: File "main.py", line 187, in net = SRResnet(lr = learning_rate,scale = scale , chk = chk) File "main.py", line 164, in init output = Convolution2D(filters =3 , kernel_size=(3,3) , strides=(1 , 1) , padding='same')(output) File "/home/dip_student/miniconda3/envs/pra36/lib/python3.6/site-packages/keras/engine/base_layer.py", line 463, in call self.build(unpack_singleton(input_shapes)) File "/home/dip_student/miniconda3/envs/pra36/lib/python3.6/site-packages/keras/layers/convolutional.py", line 141, in build constraint=self.kernel_constraint) File "/home/dip_student/miniconda3/envs/pra36/lib/python3.6/site-packages/keras/engine/base_layer.py", line 279, in add_weight weight = K.variable(initializer(shape, dtype=dtype), File "/home/dip_student/miniconda3/envs/pra36/lib/python3.6/site-packages/keras/initializers.py", line 227, in call dtype=dtype, seed=self.seed) File "/home/dip_student/miniconda3/envs/pra36/lib/python3.6/site-packages/keras/backend/tensorflow_backend.py", line 4357, in random_uniform shape, minval=minval, maxval=maxval, dtype=dtype, seed=seed) File "/home/dip_student/miniconda3/envs/pra36/lib/python3.6/site-packages/tensorflow/python/keras/backend.py", line 5253, in random_uniform shape, minval=minval, maxval=maxval, dtype=dtype, seed=seed) File "/home/dip_student/miniconda3/envs/pra36/lib/python3.6/site-packages/tensorflow/python/ops/random_ops.py", line 247, in random_uniform rnd = gen_random_ops.random_uniform(shape, dtype, seed=seed1, seed2=seed2) File "/home/dip_student/miniconda3/envs/pra36/lib/python3.6/site-packages/tensorflow/python/ops/gen_random_ops.py", line 820, in random_uniform name=name) File "/home/dip_student/miniconda3/envs/pra36/lib/python3.6/site-packages/tensorflow/python/framework/op_def_library.py", line 626, in _apply_op_helper param_name=input_name) File "/home/dip_student/miniconda3/envs/pra36/lib/python3.6/site-packages/tensorflow/python/framework/op_def_library.py", line 60, in _SatisfiesTypeConstraint ", ".join(dtypes.as_dtype(x).name for x in allowed_list))) TypeError: Value passed to parameter 'shape' has DataType float32 not in list of allowed values: int32, int64.

I Tried to remove as well as find the source of the problem but failed to do so. Kindly help me resolve the issue

rajatkb commented 4 years ago

It must be an issue with old TensorFlow version. Would recommend to use newer version Keras, transfer the code and then use the weights provided. Transferring the code should not be an issue.