Skip to content

Commit

Permalink
fix cannot restore from pretrained model to finetune problem
Browse files Browse the repository at this point in the history
  • Loading branch information
MaybeShewill-CV committed Jul 13, 2020
1 parent 20ce288 commit 74b832a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion trainner/tusimple_lanenet_multi_gpu_trainner.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,8 @@ def __init__(self):
moving_ave_op = tf.train.ExponentialMovingAverage(self._moving_ave_decay).apply(
train_var_list + tf.moving_average_variables()
)
# define saver
self._loader = tf.train.Saver(tf.moving_average_variables())

# group all the op needed for training
batchnorm_updates_op = tf.group(*batchnorm_updates)
Expand Down Expand Up @@ -240,7 +242,6 @@ def __init__(self):
# define saver and loader
with tf.variable_scope('loader_and_saver'):
self._net_var = [vv for vv in tf.global_variables() if 'lr' not in vv.name]
self._loader = tf.train.Saver(self._net_var)
self._saver = tf.train.Saver(max_to_keep=10)

# define summary
Expand Down
3 changes: 2 additions & 1 deletion trainner/tusimple_lanenet_single_gpu_trainner.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,8 @@ def __init__(self):
train_var_list = tf.trainable_variables()
moving_ave_op = tf.train.ExponentialMovingAverage(
self._moving_ave_decay).apply(train_var_list + tf.moving_average_variables())
# define saver
self._loader = tf.train.Saver(tf.moving_average_variables())

# define training op
with tf.variable_scope(name_or_scope='train_step'):
Expand Down Expand Up @@ -176,7 +178,6 @@ def __init__(self):
# define saver and loader
with tf.variable_scope('loader_and_saver'):
self._net_var = [vv for vv in tf.global_variables() if 'lr' not in vv.name]
self._loader = tf.train.Saver(self._net_var)
self._saver = tf.train.Saver(tf.global_variables(), max_to_keep=5)

# define summary
Expand Down

0 comments on commit 74b832a

Please sign in to comment.