如何修改批量归一化层(DeconvNet)以便能够与 caffe 一起运行?

2023-11-30

我想运行反卷积网络在我的数据上,但是它似乎是为另一个版本编写的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 into 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 吗?如果是的话,你能指导我吗? 谢谢


您能否告诉我这样的更改是否正确?

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
    }
  }
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

如何修改批量归一化层(DeconvNet)以便能够与 caffe 一起运行? 的相关文章