Error while drawing net in Caffe

1.6k Views Asked by At

I'm trying to draw my net in Caffe. The net is defined in expt/expt.prototxt and the desired image path is expt/net.png. When I run the command ./python/draw_net.py expt/expt.prototxt expt/net.png, I get the following error:

Couldn't import dot_parser, loading of dot files will not be possible.
Drawing net to expt/net.png
Traceback (most recent call last):
  File "./python/draw_net.py", line 44, in <module>
    main()
  File "./python/draw_net.py", line 40, in main
    caffe.draw.draw_net_to_file(net, args.output_image_file, args.rankdir)
  File "/home/pras/caffe/python/caffe/draw.py", line 165, in draw_net_to_file
    fid.write(draw_net(caffe_net, rankdir, ext))
  File "/home/pras/caffe/python/caffe/draw.py", line 156, in draw_net
    return get_pydot_graph(caffe_net, rankdir).create(format=ext)
  File "/home/pras/anaconda/lib/python2.7/site-packages/pydot.py", line 1727, in create
    'GraphViz\'s executables not found' )
pydot.InvocationException: GraphViz's executables not found

I'm running Caffe on Ubuntu 14.04 in CPU mode using the Anaconda Python interface. Any ideas why this error might be occuring and how to go about correcting it?

1

There are 1 best solutions below

1
On BEST ANSWER

The error log mentions that GraphViz's executables are not found. So, I did the following:

  1. Installed GraphViz on Ubuntu: sudo apt-get install GraphViz.
  2. Installed GraphViz for Python: pip install GraphViz.

I'm not sure if step 2 is required or not, but step 1 is definitely required. After doing that, the command to draw the net in Caffe works like a charm!