How to access data and weight stored in Blob?

101 views
Skip to first unread message

Ibrahim Ahmed

unread,
Mar 8, 2017, 1:37:55 PM3/8/17
to Caffe Users
Hi guys,

I am very new to caffe. I have very basic question here: from (http://caffe.berkeleyvision.org/tutorial/net_layer_blob.html) I understand the layers perform a specific operation. My question is, where does the weight matrix is stored for say a convolution layer? Also, do the blobs only hold final data, or they hold the weight matrix as well? 

In other words, I am not clear about the data structure of caffe. The project I am working on, I need to access the data stored in each layer, as well as the weight matrix that converts data from one layer to next. 

Could you please point me out to where should I look? I have found this link: https://github.com/yosinski/deep-visualization-toolbox which visualizes the data of each layer, but I am still unsure what to access!

Thanks in advance!

Przemek D

unread,
Mar 9, 2017, 2:42:19 AM3/9/17
to Caffe Users
There are separate blobs for data, separate for gradients and separate for weight matrices. If you look into header of the base layer class, you'll find the following:
vector<shared_ptr<Blob<Dtype> > > blobs_;
which holds weights for each layer. Data/gradient blobs are stored separately (they are not "parts" of any layer).
Exact way of accessing this depends on the interface you're using (C++, Python or MATLAB).
Reply all
Reply to author
Forward
0 new messages