一文带你用可视化理解卷积神经网络( 七 )

将模型可视化有许多种方法 , 在本文中 , 我们将展示其中的一些 。

设置模型的体系结构

实践是最好的学习方式之一 。 因此 , 我们立刻开始研究模型的代码 。

在本文中 , 我们在ImageNet数据集上使用VGG16架构模型和预训练权重 。 首先我们先将模型程序导入并开始理解其架构 。

我们将使用Keras中的'model.summary()'函数来可视化模型体系结构 。 在我们进入模型构建部分之前 , 这是非常重要的一步 。 我们需要确保输入和输出形状与我们的问题陈述相匹配 , 因此我们先可视化模型摘要 。

#importing required modules
from keras.applications import VGG16
#loading the saved model
#we are using the complete architecture thus include_top=True
model = VGG16(weights='imagenet'include_top=True)
#show the summary of model
model.summary()

以下是上述代码生成的模型摘要:

推荐阅读