Project - Introduction to Transfer Learning (Cat vs Non-cats Project)

24 / 26

Cats vs Non-cats using Transfer Learning - Visualizing the model

Let us have a complete picture of our new VGG16 model.

We could view that using the summary() method on the vgg_base and vgg_model.

Also, we could visualize them using plot_model, a Keras utility. Let's see how!

INSTRUCTIONS

Note: Make sure to execute these code lines in separate code cells of your notebook for better visualization experience.

  • View the architectural summary of the pre-trained model(without the top dense layers), which is our vgg_base, by using vgg_base.summary() as below.

    vgg_base.summary()
    
  • Import plot_model from tensorflow.keras.utils.

    from tensorflow.keras.utils import << your code comes here >>
    
  • Use the plot_model imported above to graphically visualize the architecture of pre-trained vgg_base.

    << your code comes here >>(vgg_base, show_shapes=True, show_layer_names=True)
    
    • Here, show_shapes=True is used to display the shape of input and output tensors for each layer in the model.

    • show_layer_names=True is used to display the layer names.

Similarly, let us view the architectural summary of our custom model built on top of the pre-trained VGG model, which is our vgg_model.

  • Use summary() on vgg_model to view its summary.

    vgg_model.summary()
    
  • Use the plot_model to graphically visualize the architecture of pre-trained vgg_model.

    << your code comes here >>(vgg_model, show_shapes=True, show_layer_names=True)
    
Get Hint See Answer


Note - Having trouble with the assessment engine? Follow the steps listed here

Loading comments...