From bc26ec76145ad70eb2ac9364f52695a26a9bc68a Mon Sep 17 00:00:00 2001 From: Matt Cooper Date: Fri, 9 Sep 2016 17:00:02 -0400 Subject: Fixed division mistake in error functions --- Code/utils.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Code/utils.py') diff --git a/Code/utils.py b/Code/utils.py index 6c9f891..39a7e11 100644 --- a/Code/utils.py +++ b/Code/utils.py @@ -167,7 +167,7 @@ def psnr_error(gen_frames, gt_frames): batch. """ shape = tf.shape(gen_frames) - num_pixels = tf.to_float(shape[1] * shape[2]) + num_pixels = tf.to_float(shape[1] * shape[2] * shape[3]) square_diff = tf.square(gt_frames - gen_frames) batch_errors = 10 * log10(1 / ((1 / num_pixels) * tf.reduce_sum(square_diff, [1, 2, 3]))) @@ -186,7 +186,7 @@ def sharp_diff_error(gen_frames, gt_frames): @return: A scalar tensor. The Sharpness Difference error over each frame in the batch. """ shape = tf.shape(gen_frames) - num_pixels = tf.to_float(shape[1] * shape[2]) + num_pixels = tf.to_float(shape[1] * shape[2] * shape[3]) # gradient difference # create filters [-1, 1] and [[1],[-1]] for diffing to the left and down respectively. -- cgit v1.2.3-70-g09d2