-
Notifications
You must be signed in to change notification settings - Fork 613
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
F1Score throws ValueError #2262
Comments
Hi @bjtho08, thanks for reporting the issue. It seems that we only support 2D |
@WindQAQ do you know what kind of F1 impl we have in TF/Model? |
No, but I remember that they asked us if we can migrate F1 score very long time ago. Not sure if there is any follow-up. |
@WindQAQ yes, I realized over the weekend as I was working on isolating the issue. I made a local copy, where I reshape |
Yes at tensorflow/tensorflow#31818 We have also some F1 impl in official/NLP https://github.com/tensorflow/models/search?q=f1 |
Also we had an old thread about multi-class precision recall at #1753 |
I'm afraid that it's impossible to do that if you use https://colab.research.google.com/drive/1G2HQ95iE2lqYub8i3O-kl5_mXMrIwmxg?usp=sharing |
@WindQAQ I realize this is well beyond the original issue, but how would you go about using that particular solution for batch-wise updates, like the keras progress bar, without losing the progress bar, of course. |
System information
Describe the bug
Adding F1Score to a FCNN model with image input and output, the code fails during initalization with ValueError: shapes must be equal rank, but are 1 and 3 for '{{node AssignAddVariableOp_4}} = AssignAddVariableOp[dtype=DT_FLOAT](AssignAddVariableOp_4/resource, Sum_3)' with input shapes: [], [?,?,4].
I checked and the two tensors
y_true
andy_pred
have the shapes[None, None, None, None]
and[None, None, None, 4]
.Any other metric handles this just fine (e.g. the native accuracy metric in Keras or another custom metric, that I'm using), which leads me to believe it is a bug in the FBetaScore.
I included a MWE with random data and the same error arises here.
EDIT: I also tried running the model in eager mode, which gave a slightly different error. The traceback is posted at the bottom.
Code to reproduce the issue
Other info / logs
Traceback from eager mode
The text was updated successfully, but these errors were encountered: