Thanks for asking this question, it helped me a lot.
I also used metrics=tf.keras.metrics.Accuracy() and got the error message.
For the new ones who will struggle, I found a suitable answer to understand the issue.
You should check the documentation here :
You can look to the example for model.compile
Then you read : * Typically you will use metrics=['accuracy']
*
The issue why .Accuracy() is not working might be explained by :
When you pass the strings ‘accuracy’ or ‘acc’, we convert this to one of [ tf.keras.metrics.BinaryAccuracy
], [ tf.keras.metrics.CategoricalAccuracy
], [ tf.keras.metrics.SparseCategoricalAccuracy
] based on the loss function used and the model output shape
So it means that metrics expect sth in bracket and that metrics = ‘accuracy’ doesn’t correspond to .Accuracy() but one of the 3 previous mentionned functions.
Then I tried thoses function that corresponded to metrics = ‘accuracy’ but coudn’t find a working solution like : metrics = [tf.keras.metrics.BinaryAccuracy()]
Hope it can help