Image_segmentation_Unet__v2

please help me .

You don’t show us the full exception trace, so we can’t actually see your code that invokes MaxPooling2D. But the error message seems pretty explicit: do you use the string “op” anywhere there?

Just generally speaking, we’re using the Keras “Functional API” here, so the basic syntax is that you invoke everything in “two layers”: the first layer of invocation specifies the parameter settings for MaxPooling2D and then that returns the actual function that you invoke with the input. It looks a little strange at first, but it has the following basic structure:

outputTensor = tfl.MaxPooling2D(... desired pooling parameters ...) (inputTensor)

That’s what I mean about “two layers” of function invocations. (Sorry, note that I’m trying to give suggestions without violating the rules by actually writing the code for you. :nerd_face:)

2 Likes

hello sir
I do this but it still tell me wrong value @paulinpaloalto

1624103257520

The code you show looks correct, although note that there also needs to be an “else” clause in the MaxPooling case. But the tests don’t actually check max_pooling = False. It may be that the “else” is there, but we just can see it in what you included.

But that is not what the error is pointing out: the thing that is wrong is the channel dimension on the first Conv2D layer in the Block2 case. That came out the same as in the Block 1 case, even though the input parameter for number of filters should have been different. So how could that happen? Please take another look at the code with that in mind.

hello sir
I solve it
just let 32---->n_filters
I can’t use the number :joy:

1 Like

Excellent! Yes, hard-coding is usually a problem, unless they are specific in telling you to do that. :nerd_face: