Open jizhang02 opened 5 years ago
Can you provide more context about your problem? It seems to me a problem with the expected metric function by tensorflow.
Can you provide more context about your problem? It seems to me a problem with the expected metric function by tensorflow.
Thank you for your reply! This is function I used as loss funtion:
def hausdorff_distance(y_true, y_pred):
y_true_f = K.flatten(y_true)
y_pred_f = K.flatten(y_pred)
print(type(y_pred_f))
#first method
d2_matrix = pairwise_distances(y_true_f, y_pred_f, metric='euclidean')
res = tf.math.reduce_mean(tf.math.minimum(d2_matrix, axis=0)) + tf.math.reduce_mean(tf.math.minimum(d2_matrix, axis=1))
return res
#second method
#return max(directed_hausdorff(y_true_f, y_pred_f)[-1], directed_hausdorff(y_pred_f, y_true_f)[-1])
I use hausdorff function in U-Net as loss function written in Keras, the error was "a bytes-like object is required, not 'Tensor'".
I use this hausdorff function as loss function in keras based neural network, an error happend in this hasudorff function: a bytes-like object is required, not 'Tensor' Could someone solve it? Thanks!