I found the draw_net_to_file method in draw.py and want to use it to understand the Caffe network I was given to work with better.
The problem is that the following code
import caffe
from caffe.draw import draw_net_to_file
import numpy as np
weights = 'reference_model/caffe_reference_imagenet_model.weights'
means = 'reference_model/ilsvrc_2012_mean_reshaped.npy'
model = 'reference_model/imagenet_model_deploy.prototxt'
npmeans = np.load(means)
cls = caffe.Classifier(
model,
weights,
mean=npmeans,
image_dims=(256, 256),
channel_swap=(2,1,0),
raw_scale=(255),
)
draw_net_to_file(cls, "drawn_net.png");
print "DONE"
fails with the following error
/caffe/python/caffe/draw.pyc in get_pydot_graph(caffe_net, rankdir, label_edges)
--> 105 pydot_graph = pydot.Dot(caffe_net.name, graph_type='digraph', rankdir=rankdir)
AttributeError: 'Classifier' object has no attribute 'name'
Upon closer investigation, the Classifier object really does not expose many methods of the underlying Net object, such as name. How do I instantiate a correctly working Net instance for this case?
I'm using Caffe built from revision 737ea5e936821b5c69f9c3952d72693ae5843370.