Sub topic 13
Finding Label Errors from Model Mistakes
Prerequisites and the purpose of error analysis
This chapter assumes that you know basic Python, JSON, image width and height, bounding boxes, masks, and the idea of training a supervised model. You should also know that a validation image has labels that the model does not see during training.
A model mistake is evidence about either the model, the image, or the label. Do not immediately retrain when the model fails. First inspect the image, the prediction, and the ground-truth annotation together. A missing object in the label can look like a false positive. A loose box can look like a localization failure. Error analysis separates these causes.
A practical error taxonomy
Start by recording one row for each important prediction or missed object. Use a small, stable vocabulary so different reviewers classify errors in the same way.
| Error type | Typical symptom | Label question |
|---|---|---|
| Missed object | No prediction overlaps a visible object | Is the object labelled and visible enough? |
| False positive | Prediction appears where no target exists | Is this really background, or is the class definition unclear? |
| Wrong class | Box overlaps an object but has another class | Are the two classes visually distinguishable? |
| Poor localization | Prediction and label overlap only partly | Are the box edges or polygon boundaries consistent? |
| Duplicate prediction | Several predictions cover one object | Is this a model setting issue or duplicate annotation? |
| Difficult example | Repeated failures on blur, shadows, or occlusion | Does the guideline define this case? |
For each error, check these possibilities in order:
- The object is missing from the label.
- The label has the wrong class.
- The box or mask has an incorrect boundary.
- The image is genuinely ambiguous.
- The model needs more representative training examples.
A model error becomes a label correction only after a human confirms that the annotation violates the project guideline.
Compare predictions with labels
For bounding boxes, intersection over union, or IoU, is a useful comparison. IoU divides the area shared by two boxes by the area covered by either box. An IoU of zero means no overlap. An IoU of one means identical boxes.
def box_iou(a, b):
"""Boxes use (x_min, y_min, x_max, y_max)."""
ix1 = max(a[0], b[0])
iy1 = max(a[1], b[1])
ix2 = min(a[2], b[2])
iy2 = min(a[3], b[3])
intersection = max(0, ix2 - ix1) * max(0, iy2 - iy1)
area_a = max(0, a[2] - a[0]) * max(0, a[3] - a[1])
area_b = max(0, b[2] - b[0]) * max(0, b[3] - b[1])
union = area_a + area_b - intersection
return intersection / union if union else 0.0
label = (50, 40, 150, 90)
prediction = (60, 45, 160, 95)
print(f"IoU: {box_iou(label, prediction):.3f}")A low IoU does not automatically prove that the label is wrong. The prediction may be wrong, or the object boundary may be hard to see. For segmentation, compare masks with pixel IoU and inspect the boundary at high zoom.
Build an error-analysis loop
Use a fixed review process so errors do not become anecdotes.
flowchart TD
A[Collect validation predictions] --> B[Group by error type]
B --> C[Inspect image label and prediction]
C --> D{Is the label inconsistent?}
D -->|Yes| E[Correct label and record reason]
D -->|No| F{Is the case ambiguous?}
F -->|Yes| G[Clarify guideline or add review rule]
F -->|No| H[Keep label and diagnose model]
E --> I[Revalidate corrected data]
G --> I
H --> J[Add examples or tune training]
I --> K[Measure errors again]
J --> Kcaption: A repeatable loop for turning model mistakes into dataset improvements. alt: Flowchart from collecting predictions through review, correction or model diagnosis, and repeated measurement.
Sample difficult images from several groups rather than reviewing only the worst confidence scores. Include each class, camera or device, lighting condition, object size, and level of occlusion. Otherwise, the review may improve one narrow case while leaving systematic failures untouched.
Track the original annotation, the decision, the reviewer, and the guideline rule used. Keep corrected labels versioned. After corrections, evaluate on a fixed set of images that was not used to choose the corrections. This helps distinguish real improvement from overfitting to the review batch.
Common interpretation errors
A low-confidence prediction is not necessarily an error. A high-confidence prediction can still be wrong. Confidence measures the model's score, not the truth.
Also separate data errors from distribution problems. If every label is correct but the model fails on night images, collect or sample more night images. If only one annotator's boxes are systematically loose, revise that annotator's work and the box rule. If near-duplicate frames occur in both training and validation data, metrics may look good while unseen images fail. Group related frames before splitting the dataset.
Exercise
A model predicts a car on an image, but the annotation contains no car. What should you check before calling it a false positive?
Show answer
Inspect the image and the class guideline. Check whether the car is partly hidden, whether it was missed by the annotator, whether it belongs to another defined class, and whether the prediction is a duplicate or a box on background. Only classify it as a false positive after those checks.