Fix dense depth loss and model, fix metric naming
This commit is contained in:
@@ -5,6 +5,10 @@ def dense_depth_loss_function(y, y_pred):
|
||||
"""
|
||||
Implementation of the loss from the dense depth paper https://arxiv.org/pdf/1812.11941.pdf
|
||||
"""
|
||||
if len(y.shape) == 3:
|
||||
y = tf.expand_dims(y, 3)
|
||||
if len(y_pred.shape) == 3:
|
||||
y_pred = tf.expand_dims(y_pred, 3)
|
||||
# Point-wise L1 loss
|
||||
l1_depth = tf.reduce_mean(tf.math.abs(y_pred - y), axis=-1)
|
||||
|
||||
@@ -15,6 +19,6 @@ def dense_depth_loss_function(y, y_pred):
|
||||
tf.math.abs(dx_pred - dx), axis=-1)
|
||||
|
||||
# Structural Similarity (SSIM)
|
||||
ssim = (1 - tf.image.ssim(y, y_pred, 500)) / 2
|
||||
ssim = tf.clip_by_value((1 - tf.image.ssim(y, y_pred, 100)) / 2, 0, 1)
|
||||
|
||||
return 0.1 * tf.reduce_mean(l1_depth) + tf.reduce_mean(gradient) + ssim
|
||||
|
||||
Reference in New Issue
Block a user