What pixel accuracy misses in photos
A squirrel can take up only a small patch of a photograph. Miss half of it and the model can still label almost every pixel correctly. If you’re trying to find the squirrel, that high accuracy score can hide the error you care about.
Say we want a model to color every pixel that belongs to the squirrel. The outline makes it easy to see what the model got right, what it missed, and what it included by mistake.
Where a mask goes wrong
Start with a reference mask drawn according to the annotation rules. Compare it with the model’s prediction one pixel at a time. A squirrel pixel the model finds is a true positive. A squirrel pixel it misses is a false negative. A background pixel it includes is a false positive. A background pixel it leaves alone is a true negative.
Recall asks how much of the reference squirrel the model recovered. Precision asks how much of the predicted squirrel actually belongs to the reference squirrel. If recall is low, I’d look for missing sections. If precision is low, I’d look at where the mask spills.
Why the size of the object matters
Pixel accuracy divides all correct labels by all evaluated pixels. That gives correctly labeled background the same credit per pixel as correctly labeled foreground. As the object takes up less of the frame, a mistake that covers half of it can account for a tiny fraction of the image.
Take a 10,000-pixel image where the squirrel covers 200 pixels. A mask that finds 100 of those pixels and adds zero extras gets 99% pixel accuracy. Its squirrel recall is 50%. Its squirrel IoU is also 0.50.
Intersection over union, or IoU, divides the area that the two masks share by the total area covered by either mask. Correctly labeled background stays outside that calculation. Background pixels mislabeled as squirrel still count against the score.
IoU = true positives ÷ (true positives + false positives + false negatives)
Add correctly labeled background around both masks and the IoU stays the same. Shrink the masks themselves and a few pixels of boundary error can make a bigger difference. That matters for fine details and distant subjects.
A good outline can still have the wrong label
Now give the branch a class of its own. If the model traces the branch perfectly but calls it squirrel, the outline looks plausible while the class is wrong. Each affected pixel counts as a false positive for squirrel and a false negative for tree.
Per-class IoU shows how well each category overlaps its reference. Mean IoU averages those class scores. To see which classes the model mixes up, I’d use a confusion matrix and open several examples from the biggest off-diagonal counts. That lets me look for repeated mistakes, such as fallen leaves being labeled as birds, or for annotation rules that reviewers apply differently.
What I’d check on unfamiliar photos
I’d report overall pixel accuracy alongside per-class IoU, precision, and recall, then look at overlays from photo collections held out of training. I’d pay particular attention to small subjects, objects that are partly hidden, and categories that look alike.
When a score drops, the overlay gives me somewhere to start. If a shadow hides part of the subject, I’d look for more examples under varied lighting. If the outline is right and the category is wrong, I’d review similar-looking classes and their annotation rules. Those are different fixes, and an overall accuracy score alone gives you little reason to choose one.
Themes to be expanded on
- How incomplete and leaky masks affect precision and recall at different thresholds
- How pixel accuracy and foreground IoU respond when the same mask errors occupy less of the frame
- Distinguishing boundary errors from class mix-ups
- Comparing model results class by class and across object sizes