Where it hides
- Between classes: thousands of cars, a few dozen cyclists.
- Between object and background: most candidate boxes of a detector are empty, and most pixels of a defect image are not defect.
- Inside one class: the class is common, but its night-time or rear-view examples are rare.
Why accuracy misleads
Take 1,000 inspection images, 50 of them with a defect. A model that always answers "no defect" is 95% accurate and finds nothing. Per-class precision and recall, or the F1 score of the rare class, expose it at once.
Ways to correct it
- Find and label more of the rare cases, the most reliable fix. Active learning points at the images worth labeling next.
- Oversample rare classes or undersample frequent ones while building training batches.
- Weight the loss so mistakes on rare classes cost more, or use focal loss, which down-weights easy examples.
- Augment or synthesize examples of the rare class.
- Tune the confidence threshold per class instead of one threshold for all.
FL(pₜ) = −(1 − pₜ)^γ · log(pₜ)Side effects
Repeating the same few rare images many times invites overfitting. Balancing the validation set makes its scores look better than production, where the classes stay uneven; keep validation close to the real mix.
Spotting it in Supervisely
Project statistics count objects per class, and every number opens the images behind it. AI Search finds rare scenes from a text prompt or an example. After training, the per-class metrics of the evaluation report show which classes the imbalance cost. All of this sits on the data curation side of the platform.