【问题标题】:How to store MXNet graph visualization as image in a file?如何将 MXNet 图形可视化作为图像存储在文件中?
【发布时间】:2017-09-12 20:33:28
【问题描述】:

根据this页面,MXNet计算图可以使用mx.viz.plot_network(net)进行可视化。

但这仅适用于 Jupyter 笔记本。如果没有 Jupyter 笔记本,我该怎么做?是否可以将可视化保存为文件中的图像?

【问题讨论】:

    标签: mxnet


    【解决方案1】:

    mx.viz.plot_network 返回一个graphviz.dot.Digraph 对象,它可以像任何其他Digraph 对象一样呈现到文件中。

    这是一个例子:

    # Store the Digraph in a variable
    graph = mx.viz.plot_network(net)
    
    # Pick an image format from this list: http://www.graphviz.org/doc/info/output.html
    graph.format = 'png'
    
    # Choose a filename and render the image.
    graph.render('graph')
    

    以上代码将在当前目录中的“graph.png”中呈现图形。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2021-12-07
      • 1970-01-01
      • 2014-04-30
      • 1970-01-01
      • 2011-05-08
      • 2022-01-22
      • 2011-06-15
      • 2017-06-22
      相关资源
      最近更新 更多