- 安装相应的包 :一是
pip install pydotplus
(本人是通过python安装包链接搜索进行的下载),二是在graphviz官网下载相应的版本并安装,安装是选择路径添加
,如下图: - 代码部分
from keras.utils.vis_utils import plot_model
# model表示自定义的模型名 to_file表示存储的文件名 show_shapes是否显示形状 rankdir表示方向T(top)B(Bottow)
plot_model(model,to_file='model.png',show_shapes=True,show_layer_names=False,rankdir='TB')