关于神经网络:Caffe中的缩放层

Scale layer in Caffe

我正在通过Caffe原型查找深层的残留网络,并注意到"Scale"层的外观。

1
2
3
4
5
6
7
8
9
layer {
    bottom:"res2b_branch2b"
    top:"res2b_branch2b"
    name:"scale2b_branch2b"
    type:"Scale"
    scale_param {
        bias_term: true
    }
}

但是,该层在Caffe层目录中不可用。有人可以解释此层的功能和参数的含义,还是指向Caffe的最新文档?


您可以在此处找到有关caffe的详细文档。

具体来说,对于"Scale"层,文档读取为:

Computes a product of two input Blobs, with the shape of the latter Blob"broadcast" to match the shape of the former. Equivalent to tiling the latter Blob, then computing the elementwise product.
The second input may be omitted, in which case it's learned as a parameter of the layer.

在您的情况下,(单" bottom "),似乎该层学习了一个乘以"res2b_branch2b"的比例因子。此外,由于scale_param { bias_term: true }意味着该层不仅学习乘性比例因子,而且学习常数项。因此,前向通行计算:

1
res2b_branch2b <- res2b_branch2b * \\alpha + \\beta

在培训期间,网络尝试学习\\alpha\\beta的值。


caffe.proto文件中也有一些文档,您可以搜索\\'ScaleParameter \\'。

感谢您的帖子:) Scale层正是我想要的。如果有人想要一个示例,该示例先按标量(0.5)缩放,然后" adds " -2(并且这些值不应更改):

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
layer {
  name:"scaleAndAdd"
  type:"Scale"
  bottom:"bot"
  top:"scaled"
  param {
    lr_mult: 0
    decay_mult: 0
  }
  param {
    lr_mult: 0
    decay_mult: 0
  }
  scale_param {
    filler {
      value: 0.5    }
    bias_term: true
    bias_filler {
      value: -2
    }
  }
}

(不过,也许在这里不需要衰减_mult \\。但是不知道。请参见注释。)
除此之外:

  • lr_mult:0-关闭"该参数"的学习-我认为
    第一个"param {" always(?)指代权重,第二个指代权重(lr_mult不是ScaleLayer特定的)
  • 填充器:一个" FillerParameter " [请参阅caffe.proto],告诉您如何填充省略的第二个blob。默认值为一个常量" value:... "。
  • bias_filler:参数,说明如何填充可选的偏差blob
  • bias_term:是否有偏差Blob

全部取自caffe.proto。并且:我仅在两个填充值都等于1.2的情况下测试了上面的层。