![](/img/trans.png)
[英]Will BatchNorm be trained in Tensorflow if layers get frozen but is_training is True?
[英]Different behavior for Batchnorm with is_training 'true' and 'false' - Accuracy is different for frozen models
我正在嘗試推斷 mobilenetV2 模型。
我已經使用 tensorflow/models/slim 訓練了模型。 該模型使用is_training=true
給出了適當的准確性。 但是當我這樣做時, is_training=false
並保存模型,然后推理給出的准確度非常低。
在這兩種情況下,我可以在圖表中看到以下差異。 隨着is_training=true
,則moving_mean
和moving_variance
成為Const
和Const_1
分別。 這是我能看到的唯一區別。 並且在推理過程中,這兩種情況下FusedBatchNorm
節點的輸出是不同的。
請有人幫助我了解為什么會發生這種情況以及如何解決此問題?
有同樣的問題。
使用 TF 文檔建議如下:
update_ops = tf.get_collection(tf.GraphKeys.UPDATE_OPS)
with tf.control_dependencies(update_ops):
train_step = tf.train.AdamOptimizer(1e-4).minimize(loss)
我在使用is_training進行測試時的准確度越來越高:假
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.