使用 plot_model tensorflow.keras 可视化模型

visualizing models using plot_model tensorflow.keras

>>> from tensorflow.keras.applications import VGG16
>>> from tensorflow.keras.utils import plot_model
>>> plot_model(VGG16, to_file="vgg16.png", show_shapes=True)

AttributeError: 'function' object has no attribute '_is_graph_network'

我尝试更改 show_shapes=False,但出现相同的错误。我能够获得定制模型的程序 运行。

tensorflow.keras.applications.VGG16 是您需要调用以获取 keras.Model 实例的函数。参见 https://www.tensorflow.org/api_docs/python/tf/keras/applications/VGG16

有用的东西:

from tensorflow.keras.applications import VGG16
from tensorflow.keras.utils import plot_model

plot_model(VGG16())