segmentation_models icon indicating copy to clipboard operation
segmentation_models copied to clipboard

mIoU with background in semantic segmentaion

Open Gil-TakKong opened this issue 3 years ago • 1 comments

Hi!

I have a question about background in the calculation of the mIoU.

When we calculate the mIoU of the segmentaion, usually IoU of the background is included.

In that case, mIoU is at least 0.45 even the model didn't catch anything because of the IoU(background).

I wondering about Is the calculation(mIoU with background) correct or reasonable? If the calculation is not reasonable, then how can we measure the performance of the segmentation model?

Thank you.

Gil-TakKong avatar Dec 12 '22 05:12 Gil-TakKong

Hi @Gil-TakKong

I think, background can ignored by passing class_indexes argument to the sm.metrics.IOUScore() function.

For example, to ignore background during IoU evaluation (for 3 classes CLASSES = ['sky', 'building', 'pole', 'unlabelled/background']), sm.metrics.IOUScore() function can be modified as follows:

metrics = [sm.metrics.IOUScore(threshold=0.5,class_indexes=[0,1,2]), sm.metrics.FScore(threshold=0.5,class_indexes=[0,1,2])]

Cheers

jaswindersingh2 avatar Feb 01 '23 06:02 jaswindersingh2