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.