added testing output path to args

This commit is contained in:
deeppomf 2018-02-27 11:26:54 -05:00
parent f9be3bc4bf
commit 971bebec8a
2 changed files with 8 additions and 5 deletions

View File

@ -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('--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('--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('--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() args = parser.parse_args()

11
test.py
View File

@ -6,7 +6,9 @@ import os
import matplotlib.pyplot as plt import matplotlib.pyplot as plt
import sys import sys
sys.path.append('..') sys.path.append('..')
from model import Model from model import Model
from config import *
IMAGE_SIZE = 128 IMAGE_SIZE = 128
LOCAL_SIZE = 64 LOCAL_SIZE = 64
@ -16,7 +18,7 @@ BATCH_SIZE = 16
test_npy = './lfw.npy' test_npy = './lfw.npy'
def test(): def test(args):
x = tf.placeholder(tf.float32, [BATCH_SIZE, IMAGE_SIZE, IMAGE_SIZE, 3]) x = tf.placeholder(tf.float32, [BATCH_SIZE, IMAGE_SIZE, IMAGE_SIZE, 3])
mask = tf.placeholder(tf.float32, [BATCH_SIZE, IMAGE_SIZE, IMAGE_SIZE, 1]) 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]) 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 masked = raw * (1 - mask_batch[i]) + np.ones_like(raw) * mask_batch[i] * 255
img = completion[i] img = completion[i]
img = np.array((img + 1) * 127.5, dtype=np.uint8) 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) output_image([['Input', masked], ['Output', img], ['Ground Truth', raw]], dst)
@ -91,5 +93,6 @@ def output_image(images, dst):
if __name__ == '__main__': if __name__ == '__main__':
test() if not os.path.exists(args.testing_output_path):
os.makedirs(args.testing_output_path)
test(args)