Caffe Net Surgery是否需要微调?

时间:2018-07-22 11:51:46

标签: image-processing machine-learning neural-network deep-learning caffe

我是Caffe的新手,我想将已经训练有素的caffeNet模型与ImageNet一起使用。我通过移除卷积中间conv4层进行了网络手术。

'layer {
     name: "relu3"
     type: "ReLU"
     bottom: "conv3"
     top: "conv3"
 }

 layer {
     name: "relu5-new"
     type: "ReLU"
     bottom: "conv5-new"
     top: "conv5-new"
 }

 layer {
     name: "pool5-new"
     type: "Pooling"
     bottom: "conv5-new"
     top: "pool5-new"
     pooling_param {
         pool: MAX
         kernel_size: 3
         stride: 2
      }
 }

 layer {
     name: "fc6"
     type: "InnerProduct"
     bottom: "pool5-new"
     top: "fc6"
     inner_product_param {
     num_output: 4096
     }
 }'

Full of prototxt file can be found here

保存此新网络后,精度变为0。我应该对ImageNet验证集进行微调,还是在我的新prototxt文件上出现问题?

任何帮助将不胜感激!

1 个答案:

答案 0 :(得分:0)

您最初使用的原始网络的conv4conv3conv5之间:这意味着conv5的过滤器(权重)期望输入的数量一定,而“输入的顺序”或“含义”。删除conv4后,您必须更改conv5才能接受不同数量的输入。因此,必须训练新的conv5 以适应其收到的新输入。
在这种情况下,当您引入新的conv5层时,应该在原型中定义weight_filler来指导caffe如何初始化新的权重。否则,caffe会将权重设置为零,并且在这种情况下几乎不可能进行微调。