I am doing an image segmentation task and I am using a dataset that only has ground truths but no bounding boxes or polygons.
I have 2 classes( ignoring 0 for background) and the outputs and ground truth labels are in an array like
Predicted--/---Labels
0|0|0|1|2 0|0|0|1|2
0|2|1|0|0 0|2|1|0|0
0|0|1|1|1 0|0|1|1|1
0|0|0|0|1 0|0|0|0|1
How do I calculate IoU from these ?
PS: I am using python3 with pytorch api