DLS Course 4 U-net assignment AssertionError: Error in test

import outputs
img_height = 96
img_width = 128
num_channels = 3

unet = unet_model((img_height, img_width, num_channels))
comparator(summary(unet), outputs.unet_model_output)

**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)
in
** 5 **
** 6 unet = unet_model((img_height, img_width, num_channels))**
----> 7 comparator(summary(unet), outputs.unet_model_output)

/tf/W3A2/test_utils.py in comparator(learner, instructor)
** 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”))**
** 23 **

AssertionError: Error in test

My Code

{moderator edit - solution code removed}

Have you fixed the previous problem that I pointed out? The hard-coding of the number of filters in your conv_block function?

Yes sir I have fixed the previous problem and it worked but still this one is giving an error

**Test failed **
** Expected value **

** [‘Conv2DTranspose’, (None, 12, 16, 256), 1179904] **

** does not match the input value: **

** [‘Conv2DTranspose’, (None, 12, 16, 32), 147488]**
---------------------------------------------------------------------------
AssertionError Traceback (most recent call last)
in
** 5 **
** 6 unet = unet_model((img_height, img_width, num_channels))**
----> 7 comparator(summary(unet), outputs.unet_model_output)

/tf/W3A2/test_utils.py in comparator(learner, instructor)
** 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”))**
** 23 **

AssertionError: Error in test

Are you sure that you didn’t make the exact same mistake in the upsampling block code? Note that the test case there uses 32 as the input, so you will still pass the test case there even if you made the mistake of hard-coding the number of filters to be 32 instead of respecting the input parameters.

Yes sir, I checked I have removed my mistake of hard-coding the number of filters but I am still getting an error

**Test failed **
** Expected value **

** [‘Conv2D’, (None, 96, 128, 23), 759, ‘same’, ‘linear’, ‘GlorotUniform’] **

** does not match the input value: **

** [‘Conv2D’, (None, 96, 128, 32), 1056, ‘same’, ‘linear’, ‘GlorotUniform’]**
---------------------------------------------------------------------------
AssertionError Traceback (most recent call last)
in
** 5 **
** 6 unet = unet_model((img_height, img_width, num_channels))**
----> 7 comparator(summary(unet), outputs.unet_model_output)

/tf/W3A2/test_utils.py in comparator(learner, instructor)
** 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”))**
** 23 **

AssertionError: Error in test

Notice that 23 is the number of classes, so you probably used n_filters instead of n_classes in that last Conv2D layer. Please see the comment block in that section for the instructions about what to do in that case. This is for “conv10”, the last Conv layer in the model.

Got it ! Thankyou so much Sir!!
Blessed to have a mentor like you :innocent: