【问题标题】:caffe how to set a filter using matlab?caffe 如何使用matlab设置过滤器?
【发布时间】:2016-04-12 18:43:38
【问题描述】:

我想在 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]);

【问题讨论】:

  • 你的代码有什么问题?
  • 你必须至少发布conv1层的prototxt
  • 你应该已经把this question的答案贴在这里了。

标签: deep-learning caffe matcaffe


【解决方案1】:

以下工作正常。

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2015-06-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多