How to show f1 scores for each class in tensorboard during training

573 views Asked by At

I am training a multi-class classification network. I use metrics from tensorboard-addons and compile the model like this:

import tensorflow-addons as tfa

[...]

metrics = [tfa.metrics.F1Score(num_classes=CLASSES, average=None)]
model.compile(optimizer='adam', loss=tf.keras.losses.CategoricalCrossentropy(), metrics=metrics)

Average None should give the f1 scores for each class. If I evaluate the trained model with

result = model.evaluate(dataset, return_dict=True)

I get an array with f1 scores for each class as expected.
During training however, I only get one score and one graph in tensorboard. How can I show the class wise f1 scores for each epoch during training in tensorboard.

I am using tensorflow 2.5 .

0

There are 0 answers