I am learning to develop segmentation models and this code found in kaggle https://www.kaggle.com/ligtfeather/semantic-segmentation-is-easy-with-pytorch caught my attention, I have been replicating it and I would like to know how to add the confusion matrix in a binary way to its metrics, since working with 23 classes makes me complicated to weigh how to do it and this code only has the accuracy and iou. So I could use more metrics like precision, recall or f1. Any article or forum where I can find an example implementation? or someone who can enlighten me. Perhaps simply calculate accuracy or other metrics without the need to construct the confusion matrix.

Thanks in advance.

Translated with www.DeepL.com/Translator (free version)