Visualizing a model's architecture
Due to their complexity, one of the most effective ways to debug a neural network is by visualizing its architecture. In this recipe, we'll learn about two different ways we can display a model's architecture:
- Using a text summary
- Using a visual diagram
Getting ready
We'll need both Pillow
and pydot
to generate a visual representation of a network's architecture. We can install both libraries using pip, as follows:
$> pip install Pillow pydot
How to do it…
Visualizing a model's architecture is pretty easy, as we'll learn in the following steps:
- Import all the required libraries:
from PIL import Image from tensorflow.keras import Model from tensorflow.keras.layers import BatchNormalization from tensorflow.keras.layers import Conv2D from tensorflow.keras.layers import Dense from tensorflow.keras.layers import Dropout from tensorflow.keras.layers import Flatten from tensorflow...