What happened to all 157 layers in MobileNetV2 while using model2?

Hello everyone!
In the second assignment of Course 4 Week 2, I realized that after tweaking MobileNetV2 for alpaca classification, the number of layers “seem” to have dropped from 157 to 8. I was expecting to see 158 layers since we removed the last layer and replaced it with average pooling and another output layer. However the following 8 layers happened to construct the whole neural network.

['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']

So I would like to ask the following:

  1. What happened to all those layers from the base_model?
  2. What are “Sequential”, “TensorflowOpLayer” and “Functional” layers?
  3. Is the “Functional” layer the actual MobileNetV2, but with the details hidden?
  4. Why cannot we see the overall neural network architecture?

Thank you very much in advance and have an amazing day!

It is a “nested” summary for Sequential models.
Assuming that this is stacked into “model2”, you typed “model2.summary()” to get this output. The 5th layer is “mobilenet”. You also see another Sequential API in the 2nd layer. This is “augmenter” that we defined before. To dig into each nested layer, you can check like below.

You can also get the details of 5th layer, mobilenet, with
I do not append the screenshot, as it is a long list as you know. :slight_smile:

And, I forgot to mention about another two layers ‘TenorFlowOpLayer’. Those are keras API, ‘tf.keras.applications.mobilenet_v2.preprocess_input’ that you added just in front of the base model.

1 Like

There was an interesting discussion at here. This is to add another parameter to “expand” summary. :slight_smile:
Then, I found that the status is “merged” !!!

I checked in my local environment which has newer (far newer) version of tensorflow/Keras. Here is what I got…

I guess this is what you want… My local environment is keras 2.8.0, tensorflow-macos 2.80, with tensorflow-metal 0.4.0.

1 Like

Oh yes, mine looks a lot different than yours.

Thank you so very much for your kind responses.