Forums - ERROR: CAFFE LAYER OF TYPE SCALE NOT PRECEEDED BY BATCHNORM

3 posts / 0 new
Last post
ERROR: CAFFE LAYER OF TYPE SCALE NOT PRECEEDED BY BATCHNORM
yanbophx
Join Date: 16 Oct 17
Posts: 17
Posted: Mon, 2018-01-08 19:49

Dear Sir or Madam,

I've encountered a problem when converting my caffemodel into dlc file. Basically, the error message is flagged out as below:

ERROR_CAFFE_LAYER_OF_TYPE_SCALE_NOT_PRECEEDED_BY_BATCHNORM: Cannot resolve Scale layer conv1_1/negative as it is not preceded by a BatchNorm layer into which it can be folded.

For your information, the concerned snippet of my prototxt file is pasted below:

---------------------------------
layer {
  name: "data"
  type: "Input"
  top: "data"
  input_param: {
    shape: {
      dim: 1
      dim: 3
      dim: 720
      dim: 1280
    }
  }
}
layer {
  name: "conv1_1/conv"
  type: "Convolution"
  bottom: "data"
  top: "conv1_1/conv"
  convolution_param {
    num_output: 16
    bias_term: false
    pad: 3
    kernel_size: 7
    stride: 2
  }
}
layer {
  name: "conv1_1/bn"
  type: "BatchNorm"
  bottom: "conv1_1/conv"
  top: "conv1_1/conv"
  batch_norm_param {
    use_global_stats: true
  }
}
layer {
  name: "conv1_1/negative"
  type: "Scale"
  bottom: "conv1_1/conv"
  top: "conv1_1/negative"
  scale_param {
    num_axes: 1
    bias_term: false
  }
}
layer {
  name: "conv1_1/concat"
  type: "Concat"
  bottom: "conv1_1/conv"
  bottom: "conv1_1/negative"
  top: "conv1_1/concat"
}
layer {
  name: "conv1_1/scale"
  type: "Scale"
  bottom: "conv1_1/concat"
  top: "conv1_1/concat"
  scale_param {
    num_axes: 1
    bias_term: true
  }
}

------------------------

To clarigy, BatchNorm layer conv1_1/bn outputs conv1_1/conv, which is passed into a Scale layer conv1_1/negative to get the negative value of  conv1_1/conv, the negative values conv1_1/negative are then concatenated with conv1_1/conv, and the combined blob is then feed into a Scale layer conv1_1/scale to accomplish the batchNorm+scale task.

Would you please share your thoughts on how to avoid this error message?

Cheers,

 

  • Up0
  • Down0
sword_cg
Join Date: 27 Apr 18
Posts: 7
Posted: Wed, 2018-05-16 19:24

Hi, yanbophx

I met the same problem, have you solved it? Eager to get your help.

Best wishes!

  • Up0
  • Down0
manasa
Join Date: 8 May 18
Posts: 7
Posted: Tue, 2018-07-10 16:09

I get the same problem when trying to convert resnet-18 caffe model as well . If someone is able to solve this problem , please post the solution.

Thanks

  • Up0
  • Down0
or Register

Opinions expressed in the content posted here are the personal opinions of the original authors, and do not necessarily reflect those of Qualcomm Incorporated or its subsidiaries (“Qualcomm”). The content is provided for informational purposes only and is not meant to be an endorsement or representation by Qualcomm or any other party. This site may also provide links or references to non-Qualcomm sites and resources. Qualcomm makes no representations, warranties, or other commitments whatsoever about any non-Qualcomm sites or third-party resources that may be referenced, accessible from, or linked to this site.