绘制的Keras模型没有给出尺寸 [英] Keras model to plot gives none, dimensions
问题描述
我正在尝试使用Keras绘制VGG16架构图.但是,我看到下面的图像带有None
,有些尺寸. None
是什么意思?
I am trying to plot VGG16 architecture diagram using Keras. However, i see the below image with None
, some dimension. What does None
mean, is that a bug ?
from keras.utils import plot_model
model = VGG19(include_top=True, weights='imagenet')
#print(model.summary())
plot_model(model, to_file='model_Vgg19.png',show_shapes=True)
我可以看到这是Keras中的一个已知问题: https://github .com/keras-team/keras/issues/1877 .
I can see that this is a known issue in Keras: https://github.com/keras-team/keras/issues/1877.
推荐答案
形状元组中的None
维度指的是批处理维度,这仅表示该层可以接受任何大小的输入.例如,数据集(例如MNIST)可能具有以下形状元组(60000, 28, 28, 1)
,但输入层的形状将为(None, 28, 28, 1)
.
The None
dimension in the shape tuple refers to the batch dimension which simply means that the layer can accept input of any size. For example, a dataset (e.g. MNIST) could have the following shape tuple (60000, 28, 28, 1)
but the input layer's shape would be (None, 28, 28, 1)
.
参考文献:
- keras-team/keras#2054
- Keras Documentation - Core Layers
这篇关于绘制的Keras模型没有给出尺寸的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!