I’m working on exercise 2 of Transfer Learning with MobileNet | Coursera where we have to build the alpaca_model
function.
I supplied input_shape
to the inputs layer of the model and passed those inputs into the data_augmentation
sequential model. However, the test fails as this layer has shape (None, None, 160, None)
instead of (None, 160, 160, 3)
. All the other layers have the correct shapes. All my previous and subsequent tests passed and I was even able to train the model with 90% accuracy. What could be going wrong here?
Assertion error:
Test failed
Expected value
['Sequential', (None, 160, 160, 3), 0]
does not match the input value:
['Sequential', (None, None, 160, None), 0]
---------------------------------------------------------------------------
AssertionError Traceback (most recent call last)
<ipython-input-85-0346cb4bf847> in <module>
10 ['Dense', (None, 1), 1281, 'linear']] #linear is the default activation
11
---> 12 comparator(summary(model2), alpaca_summary)
13
14 for layer in summary(model2):
~/work/W2A2/test_utils.py in comparator(learner, instructor)
21 "\n\n does not match the input value: \n\n",
22 colored(f"{a}", "red"))
---> 23 raise AssertionError("Error in test")
24 print(colored("All tests passed!", "green"))
25
AssertionError: Error in test
Alpaca model summary:
Model: "functional_33"
_________________________________________________________________
Layer (type) Output Shape Param #
=================================================================
input_61 (InputLayer) [(None, 160, 160, 3)] 0
_________________________________________________________________
sequential_1 (Sequential) (None, None, 160, None) 0
_________________________________________________________________
tf_op_layer_RealDiv_18 (Tens [(None, 160, 160, 3)] 0
_________________________________________________________________
tf_op_layer_Sub_18 (TensorFl [(None, 160, 160, 3)] 0
_________________________________________________________________
mobilenetv2_1.00_160 (Functi (None, 5, 5, 1280) 2257984
_________________________________________________________________
global_average_pooling2d_18 (None, 1280) 0
_________________________________________________________________
dropout_17 (Dropout) (None, 1280) 0
_________________________________________________________________
dense_17 (Dense) (None, 1) 1281
=================================================================
Total params: 2,259,265
Trainable params: 1,281
Non-trainable params: 2,257,984
_________________________________________________________________