Image_segmentation_Unet_v2 - build the model (problem)

I’m officially stranded with this exercise and no clue what’s going on. I even referenced other people’s code from GitHub and turns out they are using exactly the same code but it seems to have worked for them but not for me. Any help/insight in how to solve this issue is greatly appreciated.

This is the function that I’m asked to complete (but doesn’t provide the correct output):

def unet_model(input_size=(96, 128, 3), n_filters=32, n_classes=23):
“”"
Unet model

Arguments:
    input_size -- Input shape 
    n_filters -- Number of filters for the convolutional layers
    n_classes -- Number of output classes
Returns: 
    model -- tf.keras.Model
"""

This is the error message:
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)
Input In [13], 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

1 Like

Posting solution code in a public topic is discouraged and can get your account suspended. It’s okay to share stacktrace on a public post and send code to a mentor via direct message. Please clean up the post.

This function looks correct. Do click my name and message your notebook as an attachment.

1 Like

I’m sorry, this is my first post on this forum. And I don’t know how else i could make clear what my issue is if i don’t share my malfunctioning code and error message. This is the standard when posting on StackOverflow etc. Anyway, i’ll clean up my code and send you a dm. thanks

1 Like

How do I find a mentor?

1 Like

You already found one. Balaji offered to review your notebook.

Posting a screen capture image of any asserts or error messages is usually sufficient to recognize the issue.

If more is needed, then a mentor will contact you with instructions.

1 Like

Please restrict code changes to places only where required.
This is the signature of upsampling_block in the starter code:

def upsampling_block(expansive_input, contractive_input, n_filters=32):

This is your notebook version:

def upsampling_block(expansive_input, contractive_input, c=32):

Follow these steps to refresh your workspace and try again.

1 Like

Oh that’s odd. That was never my intention. I suspect that this was caused by my faulty Mac keyboard when i tried to copy paste and instead replaced by ‘c’ without me realising. Anyway, it’s working now, thanks for the help!