Image Segmentation_Unet _v2 Conv_block code

I am getting error in the conv_block, I can not figure out where the problem is. I am including a copy of the script and the error messages, please help me to find out the problem. Thanks

Don’t use hard-coded values unless you’re told to specifically.
So, don’t use 32, use “n_filters”.
Check for those types of problems.

Also, please edit your message and remove the code. Posting your code breaks the course Honor Code.

1 Like

Also, instead of posting your code, just post any error messages you get from the unit tests.
Those are usually enough to point to the problem in your code.

Thanks. I will try to edit the message.

You should have a “pencil” icon in the toolbar below your message. That’s the ‘edit’ tool.
If you don’t see it, let me know and I can edit your message.

1 Like

Thanks Mosh for the suggestions. I removed the code as you suggested.

The error is as following:
Test failed
Expected value

[‘Conv2D’, (None, 96, 128, 1024), 28672, ‘same’, ‘relu’, ‘HeNormal’]

does not match the input value:

[‘Conv2D’, (None, 96, 128, 32), 896, ‘same’, ‘relu’, ‘HeNormal’]

Most likely, in the first Conv2D layer, either your “filters=…” argument is wrong, or your “kernel_size=…” is wrong.

Be sure you use the identifiers for the arguments, because if you leave them out, you’re just relying on getting them in exactly the correct order.

Another problem might be with embedding comments inside the argument definition. Try taking those out.

This was also asked and answered on this other parallel thread. The bug is that you must be hard-coding the value of the number of filters to 32 instead of using the parameter that was passed in.

Oh, sorry, I see that @TMosh already also gave this answer earlier on this thread. So it’s been covered! :nerd_face:

Note also that in the “conv10 = …” layer, you don’t use n_filters there.