I want to use ConfusionMatrix in pytorch_lightning.metrics: pytorch_lightning.metrics.functional.confusion_matrix — PyTorch Lightning 1.1.6 documentation 1.
I’m working on a multi-class segmentation problem where my mask originally is RGB valued (N, 3, H, W) and I converted it into one-hot (N, #Class, H, W) for training. However, pytorch_lightning.metrics.utils._input_format_classification used in ConfusionMatrix, requires that my mask is integer indexed: (N, H, W). I’m wondering how can I efficiently convert transform an RGB valued mask into integer indexed?