Hello, I am getting the following error while running upsampling_block code. Any ideas what the issue is?
→ 36 ublock7 = upsampling_block(ublock6[0], cblock3[1], n_filters * 4)
37 ublock8 = upsampling_block(ublock7[0], cblock2[1], n_filters * 2)
38 ublock9 = upsampling_block(ublock8[0], cblock1[1], n_filters)
Input In [51], in upsampling_block(expansive_input, contractive_input, n_filters)
4 “”"
5 Convolutional upsampling block
6
(…)
12 conv – Tensor output
13 “”"
15 ### START CODE HERE
—> 16 up = Conv2DTranspose(
17 n_filters, # number of filters
18 3, # Kernel size
19 strides=(2,2),
20 padding=‘same’)(expansive_input)
22 # Merge the previous output and the contractive_input
23 merge = concatenate([up, contractive_input], axis=3)
File /usr/local/lib/python3.8/dist-packages/keras/utils/traceback_utils.py:67, in filter_traceback..error_handler(*args, **kwargs)
65 except Exception as e: # pylint: disable=broad-except
66 filtered_tb = _process_traceback_frames(e.traceback)
—> 67 raise e.with_traceback(filtered_tb) from None
68 finally:
69 del filtered_tb
File /usr/local/lib/python3.8/dist-packages/keras/engine/input_spec.py:228, in assert_input_compatibility(input_spec, inputs, layer_name)
226 ndim = x.shape.rank
227 if ndim is not None and ndim < spec.min_ndim:
→ 228 raise ValueError(f’Input {input_index} of layer “{layer_name}” ’
229 ‘is incompatible with the layer: ’
230 f’expected min_ndim={spec.min_ndim}, ’
231 f’found ndim={ndim}. ’
232 f’Full shape received: {tuple(shape)}’)
233 # Check dtype.
234 if spec.dtype is not None:
ValueError: Input 0 of layer “conv2d_transpose_11” is incompatible with the layer: expected min_ndim=4, found ndim=3. Full shape received: (12, 16, 256)