【发布时间】:2017-05-27 06:27:22
【问题描述】:
我对如何在我的模型中使用/插入"BatchNorm" 层有点困惑。
我看到了几种不同的方法,例如:
ResNets:"BatchNorm"+"Scale"(无参数共享)
"BatchNorm" 层紧跟"Scale" 层:
layer {
bottom: "res2a_branch1"
top: "res2a_branch1"
name: "bn2a_branch1"
type: "BatchNorm"
batch_norm_param {
use_global_stats: true
}
}
layer {
bottom: "res2a_branch1"
top: "res2a_branch1"
name: "scale2a_branch1"
type: "Scale"
scale_param {
bias_term: true
}
}
cifar10 example:只有"BatchNorm"
在 caffe 提供的 cifar10 示例中,"BatchNorm" 使用后没有任何 "Scale":
layer {
name: "bn1"
type: "BatchNorm"
bottom: "pool1"
top: "bn1"
param {
lr_mult: 0
}
param {
lr_mult: 0
}
param {
lr_mult: 0
}
}
cifar10 batch_norm_param 与 TRAIN 和 TEST 不同
batch_norm_param: use_global_scale 在TRAIN 和TEST 之间变化:
layer {
name: "bn1"
type: "BatchNorm"
bottom: "pool1"
top: "bn1"
batch_norm_param {
use_global_stats: false
}
param {
lr_mult: 0
}
param {
lr_mult: 0
}
param {
lr_mult: 0
}
include {
phase: TRAIN
}
}
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
}
}
那应该是什么?
在 caffe 中应该如何使用"BatchNorm" 层?
【问题讨论】:
-
感谢您的信息。我查看了一些当前的 prototxt。他们在 BN 中不使用
decay_mult,只使用lr_mult:0。我说的对吗? -
@user3051460
decay_mult和lr_mult对于"BatchNorm"层没有意义,因为它的参数是根据输入统计信息而不是反向传播梯度更新的。 AFAIK,最新版本的 caffe 自动将此层的lr_mult设置为零。 -
你的意思是默认值可以在github.com/BVLC/caffe/blob/…查看?因为我想检查我当前的 caffe 是否设置为零
标签: machine-learning neural-network deep-learning caffe batch-normalization