From fbbf7d15e0569d65858118aa05b2f1d8e3da2d3e Mon Sep 17 00:00:00 2001 From: Robert Lee <32447910+robertklee@users.noreply.github.com> Date: Tue, 14 Apr 2020 14:35:33 -0700 Subject: [PATCH] changed image dims to a config parameter --- config.py | 2 ++ lossFunctions.py | 8 ++------ 2 files changed, 4 insertions(+), 6 deletions(-) create mode 100644 config.py diff --git a/config.py b/config.py new file mode 100644 index 0000000..ab2d394 --- /dev/null +++ b/config.py @@ -0,0 +1,2 @@ +img_width = 640 +img_height = 192 \ No newline at end of file diff --git a/lossFunctions.py b/lossFunctions.py index 4b3315d..38dc127 100644 --- a/lossFunctions.py +++ b/lossFunctions.py @@ -12,6 +12,7 @@ import keras import keras.backend as K import tensorflow as tf +import config def findGradients(y_predicted, leftImgPyramid): @@ -72,20 +73,15 @@ def photoMetric(disp, left, right): left_f_2 = K.flatten( left[:,:,:,2]) right_f_2 = K.flatten(right[:,:,:,2]) - disp_shape = K.shape(disp) - # find the self-referantiatl indicies in the tensor indicies = K.arange(0,K.shape(disp_f)[0], dtype='float32') # offset the indicies by the disparities to make the reprojection referances for the left image - right_referances = K.clip(indicies + (disp_f * -1 * 640), 0, 640*192) - - #right_referances = K.clip(indicies + (disp_f * -1 * K.cast(disp_shape[1], 'float32')), 0, K.eval(disp_shape[0]*disp_shape[1])) + right_referances = K.clip(indicies + (disp_f * -1 * config.img_width), 0, config.img_width*config.img_height) # OK TO THIS POINT NO GRADS GET LOST intReferances = K.cast(tf.floor(right_referances), 'int32') - # gather the values to creat the left re-projected images right_f_referance_to_projected_0 = K.gather(right_f_0, intReferances) # not differentiable due to cast operation #test2 = K.eval(right_referances)