Skip to content

Commit

Permalink
changed image dims to a config parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
robertklee committed Apr 14, 2020
1 parent c915638 commit fbbf7d1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
2 changes: 2 additions & 0 deletions config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
img_width = 640
img_height = 192
8 changes: 2 additions & 6 deletions lossFunctions.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import keras
import keras.backend as K
import tensorflow as tf
import config


def findGradients(y_predicted, leftImgPyramid):
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit fbbf7d1

Please sign in to comment.