tezvyn:

How is IoU computed and why prefer mIoU?

AI-drafted, machine-checkedintermediate
WHAT IT TESTS

segmentation metrics under imbalance.

OUTLINE

IoU is intersection over union of predicted and true pixels; mIoU averages per class; pixel accuracy is dominated by background.

RED FLAG

equating accuracy with IoU.

WHAT THIS TESTS: It checks that you can define IoU precisely and reason about why a metric choice changes which models look good, especially under the class imbalance common in real scenes where one class fills most pixels.

A GOOD ANSWER COVERS: For one class, IoU equals the count of pixels correctly predicted as that class, the intersection, divided by the count of pixels predicted as or labeled as that class, the union. In confusion-matrix terms that is TP over TP plus FP plus FN. Mean IoU averages this value across every class with equal weight, so a tiny class counts as much as a huge one. Pixel accuracy is simply correct pixels over total pixels, which a lazy model can maximize by labeling everything background when background dominates the frame, exposing nothing about minority-class quality.

COMMON WRONG ANSWERS: Confusing IoU with the Dice coefficient, which equals 2TP over 2TP plus FP plus FN and is always larger than IoU. Claiming accuracy and IoU rank models the same way. Forgetting that mIoU weights classes equally rather than by their pixel frequency, which is the whole point.

LIKELY FOLLOW-UPS: How does Dice relate to IoU mathematically. Why might you report frequency-weighted IoU instead. How do you handle a class absent from an image when averaging. Whether a soft IoU is differentiable for use directly as a loss function.

ONE CONCRETE EXAMPLE: An image is ninety-five percent road and five percent pedestrian. A model that predicts all road scores ninety-five percent pixel accuracy but zero IoU on the pedestrian class, so its mIoU drops to roughly forty-eight percent. That large gap exposes the failure that accuracy hides, which is exactly why benchmarks like Cityscapes and Pascal VOC report mIoU as the headline number rather than accuracy.

Get five bites like this every day.

Tezvyn delivers a daily feed of 60-second tech bites with quizzes to lock in what you learn.