keras 模型可视化以及常见错误

14 篇文章 0 订阅

keras 可以通过如下方式可视化当前模型:

from keras.utils import plot_model

plot_model(model, to_file='model_plot.png', show_shapes=True)

在一些环境上运行上述命令,可能会出现以下错误:

  • 没有pydot 包等提示,使用pip install pydot 命令安装pydot

  • 使用pip install pydot 命令安装pydot后,使用继续运行上述命令,报错
    pydot failed to call GraphViz.Please install GraphViz (https://www.graphviz.org/) and ensure that its executables are in the $PATH.

  • 使用pip install graphviz 安装graphviz 后还是存在该错误,发现graphviz 是一个软件包,而不是一个库,所以使用Linux软件安装的方式进行安装graphviz后(安装方法如下),能够正常可视化当前模型。

    • Mac: brew install graphviz
      Redhat/Centos: yum install graphviz
      Debian/Ubuntu: apt-get install graphviz
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值