# Build the summary operation from the last tower summaries.
summary_op = tf.summary.merge_all()
- # Build an initialization operation to run below.
- init = tf.initialize_all_variables()
- sess = tf.Session()
- sess.run(init)
+ # Restore checkpoint from file.
+ if FLAGS.pretrained_model_checkpoint_path:
+ sess = tf.Session()
+ assert tf.gfile.Exists(FLAGS.pretrained_model_checkpoint_path)
+ ckpt = tf.train.get_checkpoint_state(
+ FLAGS.pretrained_model_checkpoint_path)
+ restorer = tf.train.Saver()
+ restorer.restore(sess, ckpt.model_checkpoint_path)
+ print('%s: Pre-trained model restored from %s' %
+ (datetime.now(), ckpt.model_checkpoint_path))
+ else:
+ # Build an initialization operation to run below.
+ init = tf.initialize_all_variables()
+ sess = tf.Session()
+ sess.run(init)
# Summary Writter
summary_writer = tf.summary.FileWriter(