super-resolution icon indicating copy to clipboard operation
super-resolution copied to clipboard

ValueError: The channel dimension of the inputs should be defined. Found `None`.

Open RohitKeshari opened this issue 1 year ago • 0 comments

I am getting this error. Is this a keras version error?


ValueError Traceback (most recent call last) in 4 from utils import load_image, plot_sample 5 ----> 6 model = edsr(scale=4, num_res_blocks=16) 7 model.load_weights('weights/edsr-16-x4/weights.h5') 8

~/Rohit/hackathon/2023/super-resolution/model/edsr.py in edsr(scale, num_filters, num_res_blocks, res_block_scaling) 9 x = Lambda(normalize)(x_in) 10 ---> 11 x = b = Conv2D(num_filters, 3, padding='same')(x) 12 for i in range(num_res_blocks): 13 b = res_block(b, num_filters, res_block_scaling)

~/anaconda3/envs/sisr/lib/python3.6/site-packages/tensorflow/python/keras/engine/base_layer.py in call(self, *args, **kwargs) 924 if _in_functional_construction_mode(self, inputs, args, kwargs, input_list): 925 return self._functional_construction_call(inputs, args, kwargs, --> 926 input_list) 927 928 # Maintains info about the Layer.call stack.

~/anaconda3/envs/sisr/lib/python3.6/site-packages/tensorflow/python/keras/engine/base_layer.py in _functional_construction_call(self, inputs, args, kwargs, input_list) 1096 # Build layer if applicable (if the build method has been 1097 # overridden). -> 1098 self._maybe_build(inputs) 1099 cast_inputs = self._maybe_cast_inputs(inputs, input_list) 1100

~/anaconda3/envs/sisr/lib/python3.6/site-packages/tensorflow/python/keras/engine/base_layer.py in _maybe_build(self, inputs) 2641 # operations. 2642 with tf_utils.maybe_init_scope(self): -> 2643 self.build(input_shapes) # pylint:disable=not-callable 2644 # We must set also ensure that the layer is marked as built, and the build 2645 # shape is stored since user defined build functions may not be calling

~/anaconda3/envs/sisr/lib/python3.6/site-packages/tensorflow/python/keras/layers/convolutional.py in build(self, input_shape) 185 def build(self, input_shape): 186 input_shape = tensor_shape.TensorShape(input_shape) --> 187 input_channel = self._get_input_channel(input_shape) 188 if input_channel % self.groups != 0: 189 raise ValueError(

~/anaconda3/envs/sisr/lib/python3.6/site-packages/tensorflow/python/keras/layers/convolutional.py in _get_input_channel(self, input_shape) 357 channel_axis = self._get_channel_axis() 358 if input_shape.dims[channel_axis].value is None: --> 359 raise ValueError('The channel dimension of the inputs ' 360 'should be defined. Found None.') 361 return int(input_shape[channel_axis])

ValueError: The channel dimension of the inputs should be defined. Found None.

RohitKeshari avatar Apr 04 '23 12:04 RohitKeshari