caffe icon indicating copy to clipboard operation
caffe copied to clipboard

How to use matcaffe to extract filters

Open jensen810814 opened this issue 11 years ago • 3 comments

Hi all, I'm trying to extract filters and biases by matcaffe. The following is my code:

addpath('/home/jensen810814/code/caffe/matlab/caffe/'); addpath('/home/jensen810814/code/caffe/examples/super_resolution/'); addpath('/home/jensen810814/code/caffe/examples/super_resolution/super_resolution_lmdb_data/'); addpath('/home/jensen810814/code/caffe/examples/super_resolution/Model/'); caffe('init','deploy.prototxt', 'super_resolution_iter_1000.caffemodel','test'); caffe('forward',{}); weights = caffe('get_weights'); save('/home/jensen810814/code/caffe/examples/super_resolution/filter_data.mat','weights');

But it shows an error message :

Error using caffe Invalid input size Error in model (line 9) caffe('forward',{});

I dont know what the error mean and how to solve it. I am a beginner in caffe,..can anyone help me? Please and thanks.

jensen810814 avatar Apr 19 '15 09:04 jensen810814

@jensen810814 You don't need to have "caffe('forward',{});", simply get_weights after you initialize

weiliu89 avatar Apr 19 '15 13:04 weiliu89

it works!! Thanks for your answer !! So kind of you.

jensen810814 avatar Apr 20 '15 05:04 jensen810814

I'm happy to see an answer from the community, but please ask usage questions on the caffe-users group.

shelhamer avatar Apr 27 '15 07:04 shelhamer