caffe
バッチ正規化
サーチ…
前書き
ドキュメントから:
msgstr "バッチ全体の平均値および/または単位(1)分散を持つように入力を正規化します。
このレイヤーは[1]で説明したようにバッチ正規化を計算します。
[...]
[1] S. IoffeとC. Szegedy、「バッチ標準化:内部共変量シフトを減らすことによる深いネットワークトレーニングの加速」 arXiv preprint arXiv:1502.03167(2015)。 "
パラメーター
| パラメータ | 詳細 |
|---|---|
| use_global_stats | 2016年3月2日のrohrbachの投稿から、おそらく彼は知っています: |
| (use_global_stats) | "デフォルトでトレーニング時間中、ネットワークは実行中の平均を介してグローバル平均/分散統計を計算しており、テスト時に各入力に対する確定的な出力を可能にします。ネットワークが統計情報を蓄積しているか使用しているかを手動で切り替えることができます重要:この機能を動作させるには、3つのパラメータブロブのすべて、つまりレイヤー定義でparam {lr_mult:0}を3回学習率をゼロに設定する必要があります。 |
| (use_global_stats) | これは、デフォルトでは(batch_norm_layer.cppで次のように設定されているため)、prototxt内でuse_global_statsを設定する必要はありません。 use_global_stats_ = this-> phase_ == TEST; " |
トレーニングのためのPrototxt
以下は、BatchNormレイヤーをチャネル単位のスケールとバイアスでトレーニングするための定義例です。典型的には、畳み込み層と整流層との間にBatchNorm層が挿入される。この例では、畳み込みはブロブlayerxを出力し、整流はlayerx-bnブロブを受信します。
layer { bottom: 'layerx' top: 'layerx-bn' name: 'layerx-bn' type: 'BatchNorm'
batch_norm_param {
use_global_stats: false # calculate the mean and variance for each mini-batch
moving_average_fraction: .999 # doesn't effect training
}
param { lr_mult: 0 }
param { lr_mult: 0 }
param { lr_mult: 0 }}
# channel-wise scale and bias are separate
layer { bottom: 'layerx-bn' top: 'layerx-bn' name: 'layerx-bn-scale' type: 'Scale',
scale_param {
bias_term: true
axis: 1 # scale separately for each channel
num_axes: 1 # ... but not spatially (default)
filler { type: 'constant' value: 1 } # initialize scaling to 1
bias_filler { type: 'constant' value: 0.001 } # initialize bias
}}
詳細は、 このスレッドを参照してください 。
配備のためのPrototxt
主な変更は、 use_global_statsをtrueに切り替えることtrue 。移動平均を使用するように切り替えます。
layer { bottom: 'layerx' top: 'layerx-bn' name: 'layerx-bn' type: 'BatchNorm'
batch_norm_param {
use_global_stats: true # use pre-calculated average and variance
}
param { lr_mult: 0 }
param { lr_mult: 0 }
param { lr_mult: 0 }}
# channel-wise scale and bias are separate
layer { bottom: 'layerx-bn' top: 'layerx-bn' name: 'layerx-bn-scale' type: 'Scale',
scale_param {
bias_term: true
axis: 1 # scale separately for each channel
num_axes: 1 # ... but not spatially (default)
}}
Modified text is an extract of the original Stack Overflow Documentation
ライセンスを受けた CC BY-SA 3.0
所属していない Stack Overflow