slim.batch_norm中的moving_mean和moving_variance不是trainable的,所以使用saver = tf.train.Saver(tf.trainable_variables(), max_to_keep=3)无法保存,应该改为:
var_list = tf.trainable_variables()
g_list = tf.global_variables()
bn_moving_vars = [g for g in g_list if 'moving_mean' in g.name]
bn_moving_vars += [g for g in g_list if 'moving_variance' in g.name]
var_list += bn_moving_vars
saver = tf.train.Saver(var_list=var_list, max_to_keep=3)
网友评论