2016-04-11 18 views
0

Caffe'de matlab kullanarak bir konvolüsyon filtresini güncellemek istiyorum. Nasıl yapabilirim? Şimdiye kadar benim kodum:caffe matlab kullanarak bir filtre nasıl ayarlanır?

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

ve kodunuzdaki sorun nedir? – Shai

+0

En azından “conv1” katmanının prototxtini göndermeniz gerekecek – Shai

+0

burada [bu soru] cevabını (http://stackoverflow.com/q/36551284/1714410) göndermiş olmalısınız. – Shai

cevap

0

Aşağıdakiler düzgün çalışıyor.

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'));