W3: Image_segmentation_Unet_v2

Hi,
I’ve found multiple posts regarding similar issue but could not do find hints on issue I am facing. Running the code gives trace given bellow.

Any hint would be very appreciated!

Thanks,
Daniel.

– START

Test failed
Expected value

[‘Conv2D’, (None, 48, 64, 64), 18496, ‘same’, ‘relu’, ‘HeNormal’]

does not match the input value:

[‘Conv2D’, (None, 48, 64, 32), 9248, ‘same’, ‘relu’, ‘HeNormal’]

AssertionError Traceback (most recent call last)
Input In [89], in <cell line: 7>()
4 num_channels = 3
6 unet = unet_model((img_height, img_width, num_channels))
----> 7 comparator(summary(unet), outputs.unet_model_output)

File /tf/W3A2/test_utils.py:21, in comparator(learner, instructor)
16 if tuple(a) != tuple(b):
17 print(colored(“Test failed”, attrs=[‘bold’]),
18 “\n Expected value \n\n”, colored(f"{b}“, “green”),
19 “\n\n does not match the input value: \n\n”,
20 colored(f”{a}", “red”))
—> 21 raise AssertionError(“Error in test”)
22 print(colored(“All tests passed!”, “green”))

AssertionError: Error in test

– END

If you take a look at the full output of the model “summary”, it should be clear where your implementation goes off the rails. You’ve got the wrong number of output channels at some point in the layers. If your conv_block and upsampling_block functions passed their respective tests, then it must be the case that you are invoking them incorrectly from unet_model: each one takes the number of output filters as the second argument, so those values must not agree with what the instructions told you to do. Are you sure you are using the n_filters parameter value instead of hard-coding the numbers?

Thank You Paul! I did not scale input n_filters*X for each invocation of conv_block where X I used as multiplication at each each invocation. Now this is solved.

Best regads,
Daniel.