qubvel / segmentation_models

Segmentation models with pretrained backbones. Keras and TensorFlow Keras.
MIT License
4.77k stars 1.03k forks source link

mIoU of semantic segmentation for incorrect Prediction. #553

Open Gil-TakKong opened 1 year ago

Gil-TakKong commented 1 year ago

Hi!

I am wondering about mIoU method. When I calculate mIoU of an image with incorrect prediction, if there are wrong label region, the IoU of the label is nan, not 0.

Here is the example.

Class in Ground Truth : Background, L1, L2 Class in Prediction : Background, L1, L2, L3

(1) mIoU = {IoU(BG) + IoU(L1) + IoU(L2)} / 3 Is it right?

I think, the formular should be (2) mIoU = {IoU(BG) + IoU(L1) + IoU(L2) + IoU(L3)} / 4

If (1) is right, could you explain about why the IoU of L3 is not included?

Thank you.