Hi
I have written this code and based on previous instruction I think its right. I can’t troubleshoot the error. would you help me?
Error:
ValueError Traceback (most recent call last)
in
4 num_channels = 3
5
----> 6 unet = unet_model((img_height, img_width, num_channels))
7 comparator(summary(unet), outputs.unet_model_output)
in unet_model(input_size, n_filters, n_classes)
16 # Add a conv_block with the inputs of the unet_ model and n_filters
17 ### START CODE HERE
—> 18 cblock1 = conv_block(input_size, n_filters)
19 # Chain the first element of the output of each block to be the input of the next conv_block.
20 # Double the number of filters at each new step
in conv_block(inputs, n_filters, dropout_prob, max_pooling)
19 activation=‘relu’,
20 padding=‘same’,
—> 21 kernel_initializer=‘he_normal’)(inputs)
22 conv = Conv2D(n_filters, # Number of filters
23 kernel_size = (3,3), # Kernel size
/usr/local/lib/python3.6/dist-packages/tensorflow/python/keras/engine/base_layer.py in call(self, *args, **kwargs)
980 with ops.name_scope_v2(name_scope):
981 if not self.built:
→ 982 self._maybe_build(inputs)
983
984 with ops.enable_auto_cast_variables(self._compute_dtype_object):
/usr/local/lib/python3.6/dist-packages/tensorflow/python/keras/engine/base_layer.py in _maybe_build(self, inputs)
2616 if not self.built:
2617 input_spec.assert_input_compatibility(
→ 2618 self.input_spec, inputs, self.name)
2619 input_list = nest.flatten(inputs)
2620 if input_list and self._dtype_policy.compute_dtype is None:
/usr/local/lib/python3.6/dist-packages/tensorflow/python/keras/engine/input_spec.py in assert_input_compatibility(input_spec, inputs, layer_name)
156 str(len(input_spec)) + ’ inputs, ’
157 'but it received ’ + str(len(inputs)) +
→ 158 ’ input tensors. Inputs received: ’ + str(inputs))
159 for input_index, (x, spec) in enumerate(zip(inputs, input_spec)):
160 if spec is None:
ValueError: Layer conv2d_47 expects 1 inputs, but it received 3 input tensors. Inputs received: [<tf.Tensor: shape=(), dtype=int32, numpy=96>, <tf.Tensor: shape=(), dtype=int32, numpy=128>, <tf.Tensor: shape=(), dtype=int32, numpy=3>]