From 971bebec8adff12df39efe10eb3302a93e7319ef Mon Sep 17 00:00:00 2001 From: deeppomf Date: Tue, 27 Feb 2018 11:26:54 -0500 Subject: [PATCH] added testing output path to args --- config.py | 2 +- test.py | 11 +++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/config.py b/config.py index 090e9d5..9b8964e 100644 --- a/config.py +++ b/config.py @@ -50,6 +50,6 @@ parser.add_argument('--learning_rate', dest='learning_rate', default=0.001, help # parser.add_argument('--graph_path', dest='graph_path', default='./graphs/', help='tensorboard graph') # parser.add_argument('--images_path', dest='images_path', default='./images/', help='result images path') parser.add_argument('--training_samples_path', dest='training_samples_path', default='./training_samples/', help='samples images generated during training path') - +parser.add_argument('--testing_output_path', dest='testing_output_path', default='./testing_output/', help='output images generated from running test.py path') args = parser.parse_args() \ No newline at end of file diff --git a/test.py b/test.py index d9dc2ae..c510939 100644 --- a/test.py +++ b/test.py @@ -6,7 +6,9 @@ import os import matplotlib.pyplot as plt import sys sys.path.append('..') + from model import Model +from config import * IMAGE_SIZE = 128 LOCAL_SIZE = 64 @@ -16,7 +18,7 @@ BATCH_SIZE = 16 test_npy = './lfw.npy' -def test(): +def test(args): x = tf.placeholder(tf.float32, [BATCH_SIZE, IMAGE_SIZE, IMAGE_SIZE, 3]) mask = tf.placeholder(tf.float32, [BATCH_SIZE, IMAGE_SIZE, IMAGE_SIZE, 1]) local_x = tf.placeholder(tf.float32, [BATCH_SIZE, LOCAL_SIZE, LOCAL_SIZE, 3]) @@ -50,7 +52,7 @@ def test(): masked = raw * (1 - mask_batch[i]) + np.ones_like(raw) * mask_batch[i] * 255 img = completion[i] img = np.array((img + 1) * 127.5, dtype=np.uint8) - dst = './testing_output_images/{}.jpg'.format("{0:06d}".format(cnt)) + dst = args.testing_output_path + '{}.jpg'.format("{0:06d}".format(cnt)) output_image([['Input', masked], ['Output', img], ['Ground Truth', raw]], dst) @@ -91,5 +93,6 @@ def output_image(images, dst): if __name__ == '__main__': - test() - + if not os.path.exists(args.testing_output_path): + os.makedirs(args.testing_output_path) + test(args) \ No newline at end of file