1.keras模型可视化

keras.utils.vis_utils模块提供了画出Keras模型的函数(利用graphviz)

该函数将画出模型结构图,并保存成图片:

from keras.utils import plot_model
plot_model(model, to_file='model.png')

plot_model接收两个可选参数:

  • show_shapes:指定是否显示输出数据的形状,默认为False
  • show_layer_names:指定是否显示层名称,默认为True

 

2.需要安装pydot-ng 和 graphviz依赖库

分别sudo pip install之后还是会报错 Failed to import pydot. You must install pydot and graphviz for `pydotprint` to work,可以通过 sudo apt-get install graphviz 解决.

其它方法可参考:https://stackoverflow.com/questions/36886711/keras-runtimeerror-failed-to-import-pydot-after-installing-graphviz-and-pyd

相关文章:

  • 2021-07-14
  • 2021-09-19
  • 2022-12-23
  • 2021-07-13
  • 2021-08-18
  • 2022-12-23
  • 2021-07-21
猜你喜欢
  • 2021-08-16
  • 2021-11-04
  • 2022-12-23
  • 2022-12-23
  • 2021-08-09
  • 2021-11-27
相关资源
相似解决方案