How to extract feature of an input image - Matlab wrapper?

340 views
Skip to first unread message

Cáp Hữu Quân

unread,
Apr 17, 2016, 5:22:32 AM4/17/16
to Caffe Users
Hi everyone,
I'm new user of Caffe.
I have download bvlc_reference_caffenet model and try to using it. I have an input image like a cat and I wanna extract feature of that image in a specific layer in caffenet model (fc6 or fc7).

I use
res = net.forward({im_data}); % run forward 
feature = res{1}; % get feature

But it return 1000-dims vector of softmax score.

Sorry about my bad English and thank you very much.

Ahmed Ibrahim

unread,
Apr 18, 2016, 9:33:02 AM4/18/16
to Caffe Users
I guess you are using matlab (you should have mentioned that) , if you would like to extract certain layers output you should do something else, I wrote  a simple tutorial about that here

Jan

unread,
Apr 18, 2016, 10:15:30 AM4/18/16
to Caffe Users
To make it a quick answer:

weights_FC6 = net.params(‘fc6’,1).get_data();
output_FC6 = net.blobs(‘fc6’).get_data();

(quoted from Ahmed's linked tutorial)

the return value of net.forward, which you called res, only contains the output blobs of the network (the topmost), not all intermediary blobs.

Jan

Cáp Hữu Quân

unread,
Apr 18, 2016, 10:36:49 AM4/18/16
to Caffe Users
Hi @Ahmed Ibrahim
Thank you very much for your answer. It's help me to understand and fix my problems. :-)

Vào 20:33:02 UTC+7 Thứ Hai, ngày 18 tháng 4 năm 2016, Ahmed Ibrahim đã viết:

Cáp Hữu Quân

unread,
Apr 18, 2016, 10:37:38 AM4/18/16
to Caffe Users
Hi @Jan
Thank you very much too ^_^

Vào 21:15:30 UTC+7 Thứ Hai, ngày 18 tháng 4 năm 2016, Jan đã viết:
Reply all
Reply to author
Forward
0 new messages