Cannot set bias_term to false for a conv layer

1,034 views
Skip to first unread message

mprl

unread,
Jul 1, 2016, 4:58:38 AM7/1/16
to Caffe Users
Hello all,

I'm trying to set the bias_term convolution_param of a convolution layer to false, but when i do so, i've the following error when i try to train the net.

F0701 08:55:50.416281 10515 net.cpp:160] Check failed: param_size <= num_param_blobs (2 vs. 1) Too many params specified for layer conv1
*** Check failure stack trace: ***
    @     0x7ff2c94a5778  (unknown)
    @     0x7ff2c94a56b2  (unknown)
    @     0x7ff2c94a50b4  (unknown)
    @     0x7ff2c94a8055  (unknown)
    @     0x7ff2ca03ddb8  caffe::Net<>::Init()
    @     0x7ff2ca03f148  caffe::Net<>::Net()
    @     0x7ff2ca01e2f2  caffe::Solver<>::InitTrainNet()
    @     0x7ff2ca01f872  caffe::Solver<>::Init()
    @     0x7ff2ca01fbca  caffe::Solver<>::Solver()
    @     0x7ff2ca1333a3  caffe::Creator_SGDSolver<>()
    @           0x41297c  caffe::SolverRegistry<>::CreateSolver()
    @           0x40a77d  train()
    @           0x407e53  main
    @     0x7ff2c4b60b45  (unknown)
    @           0x408698  (unknown)
    @              (nil)  (unknown)
Aborted

Can anyone help me with that ?
Thanks,

Maxime

Alperen AYDIN

unread,
Jul 1, 2016, 5:06:35 AM7/1/16
to Caffe Users
Can we have a look at your .prototxt?


Normally the layer should look like thing:

> layer{
name: ...
type: "convolution"
convolution_param
{
...
bias_term: false

}
}

mprl

unread,
Jul 1, 2016, 5:22:42 AM7/1/16
to Caffe Users
Yup !
When i write this :
layer {
  name: "conv1"
  type: "Convolution"
  bottom: "data"
  top: "conv1"
  param {
    lr_mult: 1
  }
  param {
    lr_mult: 2
  }
  convolution_param {
    num_output: 20
    kernel_size: 3
    stride: 1
    bias_term: true
    weight_filler {
      type: "xavier"
    }
    bias_filler {
      type: "constant"
    }
  }
}
It works. But when i change "bias_term" from true to false, i have the error.

Evan Shelhamer

unread,
Jul 14, 2016, 7:49:14 PM7/14/16
to mprl, Caffe Users
Caffe refuses to load weights from a layer with a different number of parameters.​

param_size <= num_param_blobs (2 vs. 1) Too many params specified for layer conv1

​indicates that the model you are fine-tuning from had biases (the two param blobs) while the new architecture with `bias_term: false` only has one blob (the filter weights). Caffe does this check to make sure the layers are compatible and force the user to resolve any differences.

You can copy over the filter weights alone through pycaffe. See for example the net surgery notebook.

Evan Shelhamer





--
You received this message because you are subscribed to the Google Groups "Caffe Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to caffe-users...@googlegroups.com.
To post to this group, send email to caffe...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/caffe-users/fabbdc72-4a78-49c1-9624-195110d451f7%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

yaozha...@gmail.com

unread,
Mar 16, 2017, 3:53:50 AM3/16/17
to Caffe Users
remove these lines
 param {
    lr_mult: 2
  }

在 2016年7月1日星期五 UTC+8下午4:58:38,mprl写道:
Reply all
Reply to author
Forward
0 new messages