From b937470f31b72d306c6e124242915e30a01d37ec Mon Sep 17 00:00:00 2001 From: Peter Mitrano Date: Thu, 18 May 2017 23:41:06 -0400 Subject: [PATCH] turns out I can't have image_batch None to start tensorboard log-dir: log_data/May_18/May_18_23:41:06/ tensorboard log-dir: --- pcanet.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pcanet.py b/pcanet.py index 76100c6..fec95bd 100755 --- a/pcanet.py +++ b/pcanet.py @@ -19,8 +19,6 @@ class PCANet: def __init__(self, hyperparams, info): self._image_batch = None - tf.summary.image('input', self._image_batch, max_outputs=10) - k1 = hyperparams['k1'] k2 = hyperparams['k2'] l1 = hyperparams['l1'] @@ -111,10 +109,12 @@ def __init__(self, hyperparams, info): self.output_features = tf.reshape(tf.transpose(self.histograms, [1, 0, 2]), [-1, l1 * num_blocks * num_hist_bins]) - def set_input_tensor(self, image_batch): + def set_input_tensor(self, image_batch, name=''): + tf.summary.image('input_' + name, image_batch, max_outputs=10) self._image_batch = image_batch + def main(): day_str = "{:%B_%d}".format(datetime.now()) time_str = "{:%H:%M:%S}".format(datetime.now()) @@ -186,7 +186,7 @@ def main(): # define the model m = PCANet(hyperparams, info) - m.set_input_tensor(train_image_batch) + m.set_input_tensor(train_image_batch, name='train') # define placeholders for putting scores on Tensorboard train_score_tensor = tf.placeholder(tf.float32, shape=[], name='train_score') @@ -219,7 +219,7 @@ def main(): # switch to test set, compute PCA filters, and score with learned SVM parameters scores = [] - m.set_input_tensor(test_image_batch) + m.set_input_tensor(test_image_batch, name='test') for i in range(4): test_pcanet_features, test_labels, merged_summary = sess.run([m.output_features, test_label_batch, merged_summary_op]) writer.add_summary(merged_summary, i + 1)