【问题标题】:Keras: display model shape in Jupyter NotebookKeras:在 Jupyter Notebook 中显示模型形状
【发布时间】:2019-08-08 18:57:44
【问题描述】:

我有以下代码用于查看我的网络架构。

不过我也想看每一层的形状,所以我尝试使用如下:

from keras.utils import plot_model
#plot_model(model, show_shapes=True, show_layer_names=True, to_file='model.png')
plot_model(model, show_shapes=True, show_layer_names=True)

输出文件“model.png”看起来不错。但我无法让它显示在 Jupyter Notebook 中。知道我错过了什么吗?谢谢!

【问题讨论】:

    标签: python-3.x tensorflow keras


    【解决方案1】:

    由于生成的图像不再是 svg 文件,您应该将 SVG 替换为 Image 使用

    from IPython.display import Image 
    ... 
    
    plot_model(model, show_shapes=True, show_layer_names=True, to_file='model.png')
    Image('model.png')
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-05-28
      • 2019-01-28
      • 1970-01-01
      • 1970-01-01
      • 2021-01-18
      • 2019-07-28
      • 1970-01-01
      • 2019-04-26
      相关资源
      最近更新 更多