2016-04-11 4 views
0

Я хочу обновить сверточный фильтр, используя matlab в Caffe. Как я могу это сделать? до сих пор мой код:caffe Как установить фильтр с помощью Matlab?

caffe.reset_all(); % reset caffe 
caffe.set_mode_gpu(); 
gpu_id = 0; % we will use the first gpu in this demo 
caffe.set_device(gpu_id); 

net_model = [model_dir, 'train_images.prototxt']; 
net = caffe.Net(net_model, 'train'); 

net.blobs('conv1').set_data([1,1,0]); 
+0

и что не так с кодом? – Shai

+0

вам придется опубликовать прототип хотя бы слоя 'conv1' – Shai

+0

, вы должны были разместить ответ [этот вопрос] (http://stackoverflow.com/q/36551284/1714410) здесь. – Shai

ответ

0

Следующие работы отлично.

caffe.reset_all(); % reset caffe 
caffe.set_mode_gpu(); 
gpu_id = 0; % we will use the first gpu in this demo  
caffe.set_device(gpu_id); 
net_model = ['net_images.prototxt']; 
net = caffe.Net(net_model, 'train') 
a = zeros(1,1,3,2); 
a(1,1,:,:) = [[1,0,0];[0,1,0]]'; % caffe uses BGR color channel order 
     net.layers('select_B_G').params(1).set_data(a); 
solver = caffe.Solver(solverFN); 
solver.solve(); 
net.save(fullfile(model_dir, 'my_net.caffemodel')); 
Смежные вопросы