# Semantic segmentation: mean IOU in presence of missing classes

It seems to me that the mean IOU is a poor metric in the presence of unbalanced classes. E.g., suppose I have 10 classes but one image has only 2 classes present in its label. Consider the prediction where the 2 classes are inverted, the IOU for these classes is 0, but the IOU for the 8 other classes is 0/0. If we consider it to be 1 (since no prediction for those classes is the correct prediction), with uniform weights the resulting mean IOU is 0.8 which makes it sound like the prediction was quite good.

It seems that the mean IOU weighted by the proportion of pixels corresponding to each class in the target image solves this problem. Are there cases where using the later over uniform mean IOU is problematic? Why is the uniform mean IOU the more popular of the two metrics?