W2's Transfer Learning with MobileNet question

Hi,

I have a question about Exercise 3 of the assignment. What is the purpose of this line?

base_model = model2.layers[4]

image

I can’t find the answer to this on the Internet.

Any help would be much appreciated!

It’s MobileNetV2 without top layers.
You can check it in the unit test cell of UNQ_C2. The summary of model2 is:

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

The 5th (index 4) layer is Functional, which is base_model in alpaca_model function.

Okay, thank you very much!