简体   繁体   中英

Different behavior for Batchnorm with is_training 'true' and 'false' - Accuracy is different for frozen models

I am trying to infer mobilenetV2 model.

I have trained the model using tensorflow/models/slim. The model is giving proper accuracy with is_training=true . But when I do, is_training=false and save the model, then inference is giving very less accuracy.

I could see the below difference in the graph in these two cases. With is_training=true , then moving_mean and moving_variance become Const and Const_1 respectively. This is the only difference I could see. And during inference, the output of FusedBatchNorm node is different in these two cases.

Please, someone, help me to understand why is it happening and how to resolve this issue?

两张图的比较

Having the same issue.

With TF Document Suggestions as given below :

update_ops = tf.get_collection(tf.GraphKeys.UPDATE_OPS)
with tf.control_dependencies(update_ops):
    train_step = tf.train.AdamOptimizer(1e-4).minimize(loss)

I am getting better Accuracy at TEST with is_training : False

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM