Skip to content

Commit

Permalink
Merge pull request thtrieu#518 from abagshaw/master
Browse files Browse the repository at this point in the history
Some modifications to TensorBoard behaviour
  • Loading branch information
abagshaw authored Jan 10, 2018
2 parents 718a116 + 89101da commit 178debe
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion darkflow/defaults.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def setDefaults(self):
self.define('dataset', '../pascal/VOCdevkit/IMG/', 'path to dataset directory')
self.define('labels', 'labels.txt', 'path to labels file')
self.define('backup', './ckpt/', 'path to backup folder')
self.define('summary', './summary/', 'path to TensorBoard summaries directory')
self.define('summary', '', 'path to TensorBoard summaries directory')
self.define('annotation', '../pascal/VOCdevkit/ANN/', 'path to annotation directory')
self.define('threshold', -0.1, 'detection threshold')
self.define('model', '', 'configuration of choice')
Expand Down
4 changes: 2 additions & 2 deletions darkflow/net/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ def setup_meta_ops(self):

if self.FLAGS.train: self.build_train_op()

if self.FLAGS.summary is not None:
if self.FLAGS.summary:
self.summary_op = tf.summary.merge_all()
self.writer = tf.summary.FileWriter(self.FLAGS.summary + 'train')

Expand All @@ -150,7 +150,7 @@ def setup_meta_ops(self):
max_to_keep = self.FLAGS.keep)
if self.FLAGS.load != 0: self.load_from_ckpt()

if self.FLAGS.summary is not None:
if self.FLAGS.summary:
self.writer.add_graph(self.sess.graph)

def savepb(self):
Expand Down
9 changes: 7 additions & 2 deletions darkflow/net/flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,20 @@ def train(self):
feed_dict[self.inp] = x_batch
feed_dict.update(self.feed)

fetches = [self.train_op, loss_op, self.summary_op]
fetches = [self.train_op, loss_op]

if self.FLAGS.summary:
fetches.append(self.summary_op)

fetched = self.sess.run(fetches, feed_dict)
loss = fetched[1]

if loss_mva is None: loss_mva = loss
loss_mva = .9 * loss_mva + .1 * loss
step_now = self.FLAGS.load + i + 1

self.writer.add_summary(fetched[2], step_now)
if self.FLAGS.summary:
self.writer.add_summary(fetched[2], step_now)

form = 'step {} - loss {} - moving ave loss {}'
self.say(form.format(step_now, loss, loss_mva))
Expand Down

0 comments on commit 178debe

Please sign in to comment.