Skip to content

Commit bf868ac

Browse files
committed
Check to see if summary flag exists.
TensorBoard is awesome...but it's not for everyone :) - don't use TensorBoard features if "summary" flag doesn't exist (mostly a fix for return_predict usage of darkflow)
1 parent e5814df commit bf868ac

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

net/build.py

+7-5
Original file line numberDiff line numberDiff line change
@@ -104,9 +104,10 @@ def setup_meta_ops(self):
104104
cfg['device_count'] = {'GPU': 0}
105105

106106
if self.FLAGS.train: self.build_train_op()
107-
108-
self.summary_op = tf.summary.merge_all()
109-
self.writer = tf.summary.FileWriter(self.FLAGS.summary + 'train')
107+
108+
if self.FLAGS.summary is not None:
109+
self.summary_op = tf.summary.merge_all()
110+
self.writer = tf.summary.FileWriter(self.FLAGS.summary + 'train')
110111

111112
self.sess = tf.Session(config = tf.ConfigProto(**cfg))
112113
self.sess.run(tf.global_variables_initializer())
@@ -115,8 +116,9 @@ def setup_meta_ops(self):
115116
self.saver = tf.train.Saver(tf.global_variables(),
116117
max_to_keep = self.FLAGS.keep)
117118
if self.FLAGS.load != 0: self.load_from_ckpt()
118-
119-
self.writer.add_graph(self.sess.graph)
119+
120+
if self.FLAGS.summary is not None:
121+
self.writer.add_graph(self.sess.graph)
120122

121123
def savepb(self):
122124
"""

0 commit comments

Comments
 (0)