【问题标题】:How can I set a global weight filler in Caffe?如何在 Caffe 中设置全局权重填充?
【发布时间】:2016-08-13 17:04:37
【问题描述】:

现在我正在逐层写权重填充,比如

layer {
  name: "Convolution1"
  type: "Convolution"
  bottom: "data"
  top: "Convolution1"
  convolution_param {
    num_output: 20
    kernel_size: 5
    weight_filler {
      type: "xavier"
    }
  }
}

如何设置全局权重填充类型? 谢谢。

【问题讨论】:

  • 如果你想要一种更“实用”的方式来定义网络,你应该查看NetSpec() python 接口。
  • @Shai 谢谢,我实际上使用的是python接口,只是想知道我是否可以在某个地方设置一次而不是逐层设置,因为在我的情况下,大多数时候我会使用“xavier”填充物。

标签: machine-learning caffe


【解决方案1】:

目前似乎没有其他方法可以做到这一点。在caffe.proto文件中,NetParameter定义如下,这里没有default_weight_filler左右这样的选项。

message NetParameter {
  optional string name = 1; // consider giving the network a name
  // DEPRECATED. See InputParameter. The input blobs to the network.
  repeated string input = 3;
  // DEPRECATED. See InputParameter. The shape of the input blobs.
  repeated BlobShape input_shape = 8;

  // 4D input dimensions -- deprecated.  Use "input_shape" instead.
  // If specified, for each input blob there should be four
  // values specifying the num, channels, height and width of the input blob.
  // Thus, there should be a total of (4 * #input) numbers.
  repeated int32 input_dim = 4;

  // Whether the network will force every layer to carry out backward operation.
  // If set False, then whether to carry out backward is determined
  // automatically according to the net structure and learning rates.
  optional bool force_backward = 5 [default = false];
  // The current "state" of the network, including the phase, level, and stage.
  // Some layers may be included/excluded depending on this state and the states
  // specified in the layers' include and exclude fields.
  optional NetState state = 6;

  // Print debugging information about results while running Net::Forward,
  // Net::Backward, and Net::Update.
  optional bool debug_info = 7 [default = false];

  // The layers that make up the net.  Each of their configurations, including
  // connectivity and behavior, is specified as a LayerParameter.
  repeated LayerParameter layer = 100;  // ID 100 so layers are printed last.

  // DEPRECATED: use 'layer' instead.
  repeated V1LayerParameter layers = 2;
}

【讨论】:

    猜你喜欢
    • 2017-11-29
    • 2016-11-12
    • 1970-01-01
    • 2016-01-15
    • 2023-04-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-04-13
    相关资源
    最近更新 更多