apache / mxnet

Lightweight, Portable, Flexible Distributed/Mobile Deep Learning with Dynamic, Mutation-aware Dataflow Dep Scheduler; for Python, R, Julia, Scala, Go, Javascript and more
https://mxnet.apache.org
Apache License 2.0
20.78k stars 6.79k forks source link

How to Save visualized networks in jpg/png? #7215

Closed ChidanandKumarKS closed 7 years ago

ChidanandKumarKS commented 7 years ago

How to Save visualized networks in jpg/png? in python code

Environment info

Operating System: Ubuntu 16.0.4

Compiler:

Package used Python

MXNet version: 0.9.3

Or if installed from source: 0.9.3

If you are using python package, please provide

Python version and distribution: 2.7.13,

Ldpe2G commented 7 years ago

https://github.com/dmlc/mxnet/blob/master/python/mxnet/visualization.py#L167

try call plot_network with save_format='jpg'

ChidanandKumarKS commented 7 years ago

I have given "mx.viz.plot_network(softmax, title="Deformable convnets.jpg",save_format='jpg')" where softmax is the final layer of network. Network has been visualized using jupyter but network is not saved either in 'pdf' or 'jpg or 'png'. Kindly suggest the solution how to go further

Ldpe2G commented 7 years ago

For example:

digraph = mx.viz.plot_network(net, save_format = 'jpg')
digraph.render()
ChidanandKumarKS commented 7 years ago

Small correction: I have used digraph = mx.viz.plot_network(softmax,title="Deformable convnets.jpg",save_format='jpg') digraph.view() I got the images of the network in JPG/PNG/Pdf format But if the network is quite big enough, then not able to save contents of graph , only blank white image. Why so? Any solution pls.

ChidanandKumarKS commented 7 years ago

Got the solution for bigger network. It should be saved as pdf not JPG/PNG.

Thanks

anjiang2016 commented 6 years ago

mxnet import the Digraph to display the networks photo pic, so u can use the function digraph.view() to display, and u can use function render() to save the image, the example code digraph = mx.viz.plot_network(net, save_format = 'jpg') digraph.view() digraph.render()