I have a problem with the convolutional block. For me all looks right but I have an error. I checked the parameters for the different convolutional blocks. The input for the shortcut path is also correct!
I also had the same error. In third main path, I used a Activation instead of BatchNorm. If someone gets the above error, please check “The details of the convolutional block” carefully.
@dexcrew I too have the same error. I tried hard rectifying it but all in vain. I am posting my code here could you plz take a quick look and give me the hint to sort out the issue
MAIN PATH
# First component of main path glorot_uniform(seed=0)
X = Conv2D(filters = F1, kernel_size = (1,1), strides = (s, s), padding='valid', kernel_initializer = initializer(seed=0))(X)
X = BatchNormalization(axis = 3)(X, training = training)
X = Activation('relu')(X)
### START CODE HERE
## Second component of main path (≈3 lines)
X = Conv2D(filters = F2, kernel_size = (f,f), strides = (1, 1), padding='same', kernel_initializer =initializer(seed=0))(X)
X = BatchNormalization(axis = 3)(X, training = training)
X = Activation('relu')(X)
## Third component of main path (≈2 lines)
X = Conv2D(filters=F3, kernel_size=(1, 1), strides=(1, 1), padding='valid', kernel_initializer=initializer(seed=0))(X)
X = BatchNormalization(axis = 3)(X, training = training)
##### SHORTCUT PATH ##### (≈2 lines)
X_shortcut = Conv2D(filters = F3, kernel_size = (1,1), strides = (s,s), padding='valid', kernel_initializer =initializer(seed=0))(X)
X_shortcut = BatchNormalization(axis = 3)(X_shortcut, training = training)
# Final step: Add shortcut value to main path, and pass it through a RELU activation (≈2 lines)
X = Add()([X, X_shortcut])
X = Activation('relu')(X)
### END CODE HERE
Had the same issue. I believe the problem is that you are passing (X) to the Conv2D() function in the Shortcut Path. Instead you should be passing X_shortcut
Posting the code on Discourse is a violation. I hope that your query is resolved, and if not, the notebook has been updated and you need to get the latest version. Thanks!
I am having exactly the same issue, but I checked everything and all seems to be correct. I don´t find what the mistake is. I have spent literally days trying to figure out what the error is but don´t find it.
If you have “exactly the same issue”, then, you have the answer in here already. For example, sesteban provides the fix for Moneet_Mohan_devadig’s case.
If that is not the case, I recommend you to create a new thread. Then, we can focus on your case.
I’m also having the very same problem as everyone on this thread has had. I’ve carefully gone through the various fixes people have mentioned, but I still get the “AssertionError: Wrong values when training=False.” Is there another approach that might work?
This chart does not include BatchNorm and Activation.
This is quite similar to the identity block (Exercise 1), but one big difference is a convolutional layer in the short cut side. In the main path, “X” is passed throughout the layers. But, short cut side is not. Please check step by step with the chart above.
Hi, Nobu. How do you generate the graph above? I’ve gone through my code as carefully as I can. I’ve changed X to X.shortcut, rechecked my activation functions (as well as when to use them), and gone through all kernel and strides variables as provided in the instructions. In fact, those instructions are so clear that I’m surprised I am getting the error at all.
I found the source of error. But I’d still like to know how to generate the graph that you posted, as it would be a good guide to analyze future models.