Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

data structure not support Tensor? #5

Open
jizhang02 opened this issue Mar 9, 2019 · 2 comments
Open

data structure not support Tensor? #5

jizhang02 opened this issue Mar 9, 2019 · 2 comments

Comments

@jizhang02
Copy link

jizhang02 commented Mar 9, 2019

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!

@mavillan
Copy link
Owner

mavillan commented Apr 9, 2019

Can you provide more context about your problem? It seems to me a problem with the expected metric function by tensorflow.

@jizhang02
Copy link
Author

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'".
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants