![](/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.