How to pull weights out of the caffemodel? parsing of caffemodel?

597 views
Skip to first unread message

Farik John

unread,
May 17, 2016, 10:17:22 AM5/17/16
to Caffe Users
I want to get the weights of convolution layers from trained caffemodel.
Anyone tried to do this before.
Please guide me.
Thanks.
Message has been deleted

Yahia Charif

unread,
May 17, 2016, 10:35:03 AM5/17/16
to Caffe Users
Hi John,
do you want to transfer leaning from the pre-trained model ? 

Clément Fuji Tsang

unread,
May 17, 2016, 10:36:06 AM5/17/16
to Caffe Users
use the pycaffe interface, 

just open the model:
import caffe
net = caffe.Net(deploy.prototxt, model.caffemodel, caffe.TEST)
then you can look inside the model like this way:
net.params.items()[layer's number][0 = name of the layer / 1 = layer's learnable data][0 = usually weights and 1 = usually bias]

please notice that you can only see the layer's that can learn (no activation, pooling or dropout).

Clément

Farik John

unread,
May 17, 2016, 12:12:03 PM5/17/16
to Caffe Users
Thanks for your nice answer.

BIng Frank

unread,
Nov 24, 2016, 9:52:33 AM11/24/16
to Caffe Users
Hi,
Clement, I succesfully  pull weights out of the caffemodel using your method , but when I try to change the weights in caffemodel , I failed . Do you know what the problem is ?
在 2016年5月18日星期三 UTC+8上午12:12:03,Farik John写道:
Reply all
Reply to author
Forward
0 new messages