C4 W2: Transfer Learning with MobileNetV2

Good Day Everyone,

I have an error that I don’t know how to solve. Even though I followed all the given instructions in Exercise 2: alpaca_model, it keeps giving me the same error which is:

AssertionError: The number of layers in the model is incorrect. Expected: 8 Found: 7

Anyone has any idea how to solve it or if there is something I should check?

Thanks in advance

If you look at the test cell, you see this.

from test_utils import summary, comparator

alpaca_summary = [['InputLayer', [(None, 160, 160, 3)], 0],
                    ['Sequential', (None, 160, 160, 3), 0],
                    ['TensorFlowOpLayer', [(None, 160, 160, 3)], 0],
                    ['TensorFlowOpLayer', [(None, 160, 160, 3)], 0],
                    ['Functional', (None, 5, 5, 1280), 2257984],
                    ['GlobalAveragePooling2D', (None, 1280), 0],
                    ['Dropout', (None, 1280), 0, 0.2],
                    ['Dense', (None, 1), 1281, 'linear']] #linear is the default activation

This is the expected summary.
Once you import “summary” from test_utils by this cell, then, you can check your model with,

summary(model2)

Then, you can compare to the expected output, and will find a missing layer in your model.

Hope this helps.