【问题标题】:How to modify batch normalization layers (DeconvNet) to be able to run with caffe?如何修改批量归一化层(DeconvNet)以便能够与 caffe 一起运行?
【发布时间】:2018-04-11 10:05:37
【问题描述】:

我想在我的数据上运行Deconvnet,但它似乎是为另一个版本的caffe 编写的。有谁知道如何更改batch_params

Deconvnet 中的那个

layers { bottom: 'conv1_1' top: 'conv1_1' name: 'bn1_1' type: BN
  bn_param { scale_filler { type: 'constant' value: 1 }
             shift_filler { type: 'constant' value: 0.001 }
             bn_mode: INFERENCE } }

Caffe 为cifar10 提供的例子:

layer {
  name: "bn1"
  type: "BatchNorm"
  bottom: "pool1"
  top: "bn1"
  batch_norm_param {
    use_global_stats: true
  }
  param {
    lr_mult: 0
  }
  param {
    lr_mult: 0
  }
  param {
    lr_mult: 0
  }
  include {
    phase: TEST
  }
}

一旦我想运行它,首先显示以下错误:

I1029 13:46:47.156885 11601 solver.cpp:87] Creating training net from net file: train_val.prototxt
[libprotobuf ERROR google/protobuf/text_format.cc:299] Error parsing text-format caffe.NetParameter: 59:3: Unknown enumeration value of "BN" for field "type".
F1029 13:46:47.157971 11601 upgrade_proto.cpp:88] Check failed: ReadProtoFromTextFile(param_file, param)

BN改成BatchNorm后,出现新的参数错误:

I1029 14:03:38.497725 12097 solver.cpp:87] Creating training net from net file: train_val.prototxt
[libprotobuf ERROR google/protobuf/text_format.cc:299] Error parsing text-format caffe.NetParameter: 59:3: Unknown enumeration value of "BatchNorm" for field "type".
F1029 14:03:38.503345 12097 upgrade_proto.cpp:88] Check failed: ReadProtoFromTextFile(param_file, param)

有人试过训练 Deconvnet 吗?如果是的话,你能指导我吗? 谢谢

【问题讨论】:

  • 您似乎使用的是旧的 caffe 版本。请重新设置为最新的master 版本,然后尝试使用type: "BatchNorm"
  • 至于scale和bias/shift,需要额外添加"Scale"层。请参阅this thread 了解更多信息。
  • 我在 3 个月前几乎是从 caffe 网站的 master 分支安装的。感谢帮助。会尝试
  • 您的 caffe 似乎将 "type" 视为枚举而不是字符串:枚举在旧版本中使用,不再使用。
  • 第一个来自Deconvnet,我没有更改,我只是想知道我应该对他们的代码做什么样的更改。我的 caffe 版本是1.0.0

标签: caffe conv-neural-network image-segmentation pycaffe batch-normalization


【解决方案1】:

请告诉我这样更改是否正确?

layer {
  name: "bn1_1"
  type: "BatchNorm"
  bottom: "conv1_1"
  top: "conv1_1"
  param {
    lr_mult: 0
  }
  param {
    lr_mult: 0
  }
  param {
    lr_mult: 0
  }
  include {
    phase: TEST
  }
  batch_norm_param {
    use_global_stats: true
  }
}
layer {
  name: "scale_conv1_1"
  type: "Scale"
  bottom: "conv1_1"
  top: "conv1_1"
  scale_param {
    bias_term: true
    bias_filler {
      type: "constant"
      value: 0.001
    }
  }
}

【讨论】:

  • 秤的填充物怎么样?
  • 亲爱的 Shai,我正在通过 caffe.NetSpec() 创建图层,所以我这样写 scale=L.Scale(conv,in_place=True,bias_term=1,bias_filler=dict(type='constant', value=0.001))。我该如何添加它,我认为它的值是1 所以比​​例没有改变,我错了吗?
猜你喜欢
  • 1970-01-01
  • 2019-01-13
  • 1970-01-01
  • 2020-04-04
  • 2017-05-10
  • 2014-11-24
  • 2019-06-16
  • 2019-09-16
  • 2016-07-22
相关资源
最近更新 更多