slim.batch_norm无法保存参数

2017-09-18  本文已影响0人  zhenggeaza

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)

上一篇下一篇

猜你喜欢

热点阅读