Although it sounds silly, I'm not finding an official source to compute mIoU.

I'm realizing a semantic segmentation task, and I want to compute the mIoU over a dataset. My doubt is, should I compute the mIoU of each image and average the results in the end, or should I build a giant confusion matrix of all image results and compute the mIoU from there?


1 Answer 1


I came across this very question myself while I was trying to replicate the results reported on a paper relevant to semantic segmentation.

It turns out there is not really a universal way of computing the mIoU and you should rather opt to simply use the same mIoU definition with the ones you are comparing with.

For instance, in the literature relevant to weakly-supervised semantic segmentation they are using the pixel-wise mIoU (through computing the confusion matrix).

In this repository you can find a function calculating the pixel-wise mIoU given the ground truth and the predicted segmentation masks.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.