简体   繁体   English

Caffe,在图层中设置自定义权重

[英]Caffe, setting custom weights in layer

I have a network. 我有网络。 In one place I want to use concat. 在一个地方,我想使用concat。 As on this picture. 就像这张照片一样。 图片

Unfortunately, the network doesn't train. 不幸的是,网络无法训练。 To understand why I want to change weights in concat. 了解为什么我要在concat中更改权重。 Meaning that all values from FC4096 will get 1 and all values from FC16000 will get 0 at the beginning. 这意味着,FC4096的所有值将在开始时为1,而FC16000的所有值将在开始时为0。

I know that FC4096 will get me 57% accuracy, so with learning rate 10^-6 I will understand why after concatenation layers didn't learn. 我知道FC4096将为我提供57%的准确度,因此以10 ^ -6的学习速度,我将理解为什么在连接层之后仍无法学习。

The question is, how can I set all values from FC4096 to 1 and all values from FC16000 to 0? 问题是,如何将FC4096的所有值设置为1,将FC16000的所有值设置为0?

You can add a "Scale" layer on top of FC16000 and init it to 0: 您可以在FC16000顶部添加一个"Scale"层并将其初始化为0:

layer {
  name: "scale16000"
  type: "Scale"
  bottom: "fc16000"
  top: "fc16000"  # not 100% sure this layer can work in-place, worth trying though.
  scale_param {
    bias_term: false
    filler: { type: "constant" value: 0 }
  }
  param { lr_mult: 0 decay_mult: 0 } # set mult to non zero if you want to train this scale
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM