Caffe,在图层中设置自定义权重 [英] Caffe, setting custom weights in layer

查看:219
本文介绍了Caffe,在图层中设置自定义权重的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个网络.在一个地方,我想使用concat.就像这张照片一样.

I have a network. In one place I want to use concat. As on this picture.

不幸的是,网络无法训练.了解为什么我要在concat中更改权重.这意味着,FC4096的所有值将在开始时都为1,而FC16000的所有值将在开始时为0.

Unfortunately, the network doesn't train. To understand why I want to change weights in concat. Meaning that all values from FC4096 will get 1 and all values from FC16000 will get 0 at the beginning.

我知道FC4096将为我提供57%的准确度,因此以10 ^ -6的学习率,我将理解为什么在连接层不学习之后的原因.

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中的所有值设置为1,将FC16000中的所有值设置为0?

The question is, how can I set all values from FC4096 to 1 and all values from FC16000 to 0?

推荐答案

您可以添加 <FC16000顶部的c0> 层并将其初始化为0:

You can add a "Scale" layer on top of FC16000 and init it to 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
}

这篇关于Caffe,在图层中设置自定义权重的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆