Per-label accuracy and precision metrics for multil-label learning?

I’m using fastai vision for multi-label classification.
eg. similar to:

Right now, the accuracy_multi eg.

epoch train_loss valid_loss accuracy_multi time
0 0.638403 0.351534 0.867729 00:05

is being printed out after each loop, but this is the accuracy across all labels.

I’d like to be able to print out the accuracy and precision for each label after each loop. (eg. If I have five labels, I’d have 5 columns in the training loop output).

How can I print out per-label accuracy metrics after each training loop?

Hi kply hope all is well!
You may be able to do this using callbacks.


Maybe the above two links can point you in the right direction.

Cheers mrfabulus1 :smiley: :smiley:

You might want to have a look at this blog

It’s maybe not the metric that you need but the way he implements the per class IOU might be helpful

1 Like

Ah perfect thank you @mrfabulous1 and @lukemshepherd. Metric callbacks seem like the right way to do this and this blogpost:


is exactly what I needed. Thank you!
2 Likes