ResNet50 - Getting the below error

Hi,

I am implementing the ResNet50 (DLS - Course 4 - W2 - Assignment 1 - Residual Networks) and getting the below error. I have verified my code and it does not look like there are any mistakes from my side. Also, looking into the error it seems it is also throwing error from Stage 2 which is not part of my coding.

Am I missing anything here. Any help is appreciated. Thank you!

TypeError Traceback (most recent call last)
Input In [70], in <cell line: 1>()
----> 1 model = ResNet50(input_shape = (64, 64, 3), classes = 6)
2 print(model.summary())

Input In [69], in ResNet50(input_shape, classes)
31 # Stage 2
32 X = convolutional_block(X, f = 3, filters = [64, 64, 256], s = 1)
—> 33 X = identity_block(X, 3, [64, 64, 256])
34 X = identity_block(X, 3, [64, 64, 256])
36 ### START CODE HERE
37
38 # Use the instructions above in order to implement all of the Stages below
(…)
42 # convolutional_block with correct values of f, filters and s for this stage
43 # The convolutional block uses three sets of filters of size [128,128,512], “f” is 3 and “s” is 2.

Input In [10], in identity_block(X, f, filters, training, initializer)
41 X = BatchNormalization(axis = 3)(X, training = training) # Default axis
43 ## Final step: Add shortcut value to main path, and pass it through a RELU activation (≈2 lines)
—> 44 X = Add()(, [X_shortcut])
45 X = Activation(‘relu’)(X)
46 ### END CODE HERE

File /usr/local/lib/python3.8/dist-packages/keras/utils/traceback_utils.py:67, in filter_traceback..error_handler(*args, **kwargs)
65 except Exception as e: # pylint: disable=broad-except
66 filtered_tb = _process_traceback_frames(e.traceback)
—> 67 raise e.with_traceback(filtered_tb) from None
68 finally:
69 del filtered_tb

File /usr/local/lib/python3.8/dist-packages/keras/utils/traceback_utils.py:92, in inject_argument_info_in_traceback..error_handler(*args, **kwargs)
90 bound_signature = None
91 try:
—> 92 return fn(*args, **kwargs)
93 except Exception as e: # pylint: disable=broad-except
94 if hasattr(e, ‘_keras_call_info_injected’):
95 # Only inject info for the innermost failing call

TypeError: call() takes 2 positional arguments but 3 were given

Hello @Mithun_Kar!

Double-check your Exercise 1 - identity_block, especially the below lines:

## Final step: Add shortcut value to main path, and pass it through a RELU activation (≈2 lines)
X = None
X = None 
    

Given that:
Hint: The syntax will look something like Add()([var1,var2])

Best,
Saif.

The exception is thrown in identity_block and the “Add” call there is part of the code you wrote. What does that line actually look like? I’ve never seen that checkmark notation that you show in the exception trace. Are you sure you passed the test cases for identity_block?

Thanks Saif. I have corrected the call for Add(). I was only focusing on my model ‘ResNet50’. The identity_block() indeed shown me error however I overlooked since the Expected Results also had a text like “All tests passed!”. Arguments passed in the Add() was wrong and now I have corrected it. The assignment is submitted and got it 100% correct now.

Thanks so much!

Thanks Paulin. I have corrected the call for Add(). I was only focusing on my model ‘ResNet50’. The identity_block() indeed shown me error however I overlooked since the Expected Results also had a text like “All tests passed!”. Arguments passed in the Add() was wrong and now I have corrected it. The assignment is submitted and got it 100% correct now.

Thanks so much!

I am glad you passed it.

Best,
Saif.