Showing posts with label pydot. Show all posts
Showing posts with label pydot. Show all posts

Caffe: Visualizing Caffe Network prototxt file using GraphViz: draw_net.py

Visualizing Caffe Net topology/ntwork/prototxt file using GraphViz
From the Caffe root directory, you can generate a graph in image format from a .prototxt model file:

#INSTALL PRE-REQS:
$ make pycaffe
$ pip install pydotplus
$ yum install graphviz

Visualize a CNN in left-to-right:

#goto CAFFE ROOT
$ python/draw_net.py mynetwrk.prototxt mynetwrk.png

Output formats could be : PNG, PDF, DOT or other GraphViz supported formats.
Visualize a CNN in top-to-bottom:

$ python/draw_net.py --rankdir TB mynetwrk.prototxt mynetwrk.png

Following errors can be eliminated if you install the PRE-REQS (pip install pydotplus; yum install graphviz)

pydotplus.graphviz.InvocationException: GraphViz's executables not found
Exception: "dot" not found in path.
ImportError: No module named pydot

Python contextlib for Timing Python code

If you've ever found yourself needing to measure the execution time of specific portions of your Python code, the `contextlib` module o...