Skip to content
This repository was archived by the owner on Nov 21, 2023. It is now read-only.

unable to visualize the network with pydot #384

Open
twmht opened this issue Apr 19, 2018 · 9 comments
Open

unable to visualize the network with pydot #384

twmht opened this issue Apr 19, 2018 · 9 comments

Comments

@twmht
Copy link

twmht commented Apr 19, 2018

Hi,

I want to visualize FPN network with pydot. I add the rendering process after creating the network.

def create_model():
    """Build the model and look for saved model checkpoints in case we can
    resume from one.
    """
    # skip many lines
    logger.info('Building model: {}'.format(cfg.MODEL.TYPE))
    model = model_builder.create(cfg.MODEL.TYPE, train=True)

    # rendering the graph
    graph = net_drawer.GetPydotGraph(model.net)
    graph.write_png('network.png')

    return model, weights_file, start_iter, checkpoints, output_dir

but pydot get stuck at write_png without throwing errors.

any idea?

thank you.

@ir413
Copy link
Contributor

ir413 commented Apr 19, 2018

Hi @twmht, net_drawer.GetPydotGraph may not be getting stuck but just taking a very long time.
You could try using net_drawer.GetPydotGraphMinimal which is faster but only draws the op nodes.

@twmht
Copy link
Author

twmht commented Apr 19, 2018

@ir413

even though switching to net_drawer.GetPydotGraphMinimal, it still took very long time to complete. I have been waiting for 30 minutes and it still does not finish.

@twmht
Copy link
Author

twmht commented Apr 19, 2018

after ctrl-C, it shows up where it stuck with

File "tools/train_net.py", line 129, in <module>
    main()
  File "tools/train_net.py", line 111, in main
    checkpoints = utils.train.train_model()
  File "/home/tumh/detectron/lib/utils/train.py", line 54, in train_model
    model, weights_file, start_iter, checkpoints, output_dir = create_model()
  File "/home/tumh/detectron/lib/utils/train.py", line 135, in create_model
    graph.write_png('network.png')
  File "/home/tumh/.pyenv/versions/faster-rcnn/lib/python2.7/site-packages/pydot.py", line 1691, in <lambda>
    self.write(path, format=f, prog=prog))
  File "/home/tumh/.pyenv/versions/faster-rcnn/lib/python2.7/site-packages/pydot.py", line 1774, in write
    s = self.create(prog, format)
  File "/home/tumh/.pyenv/versions/faster-rcnn/lib/python2.7/site-packages/pydot.py", line 1886, in create
    stdout_data, stderr_data = p.communicate()
  File "/home/tumh/.pyenv/versions/2.7.12/lib/python2.7/subprocess.py", line 800, in communicate
    return self._communicate(input)
  File "/home/tumh/.pyenv/versions/2.7.12/lib/python2.7/subprocess.py", line 1417, in _communicate
    stdout, stderr = self._communicate_with_poll(input)
  File "/home/tumh/.pyenv/versions/2.7.12/lib/python2.7/subprocess.py", line 1471, in _communicate_with_poll
    ready = poller.poll()

@twmht
Copy link
Author

twmht commented Apr 19, 2018

I write the raw data by graph.write("network.txt"), it contains 1550 nodes. I am not sure if this is too big for pydot.

However, even though all of these nodes can be visualized with png, it's still hard to visualize with human eyes.

It would be great if it only provides layer-level virtualization, with some visualization tools like netscope (http://ethereon.github.io/netscope/quickstart.html).

And I think this should be a caffe2 issue, not detectron.

@twmht twmht closed this as completed Apr 19, 2018
@liujing1995
Copy link

Have you solved the question? I have the same problem.

@twmht
Copy link
Author

twmht commented May 31, 2018

@liujing1995

no, I have not solved this problem.

it seems that it's not an issue of caffe2. it's an issue of pydot.

@liujing1995
Copy link

@twmht
I found someone could visualize the network with pydot during test time.But I can't use it to visualize the training network #320

@twmht
Copy link
Author

twmht commented May 31, 2018

ok. reopen this issue to discuss more.

@twmht twmht reopened this May 31, 2018
@drcege
Copy link

drcege commented Jun 28, 2018

#508 works well for inference model. The problems are all about training model.


Even the GetPydotGraphMinimal is too large for graphviz.

After many tries, I still cannot draw a graph. I could only save the PydotGraph to a raw .dot file. When converting the dot file to pdf / png / svg by graphviz(dot) , it hangs just like this question.

neato and twopi may give results, but the nodes are overlapped so unreadable.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants