Home / Companies / Roboflow / Blog / Post Details
Content Deep Dive

Fix Class Imbalance in Defect Detection

Blog post from Roboflow

Post Details
Company
Date Published
Author
Mostafa Ibrahim
Word Count
1,616
Company Posts That Month
12
Language
English
Hacker News Points
-
Post removed?
No
Summary

Class imbalance in manufacturing defect detection can cause models to perform well on common defects while missing rare but important ones, making per-class AP a more useful metric than overall mAP. Using an RF-DETR Small model on a fabric dataset with a 50:1 Stitch-to-Hole imbalance, the study compared data-level approaches while keeping evaluation splits and training configuration constant. It recommends collecting additional real rare-defect examples through active learning when visual diversity is insufficient, oversampling when existing rare examples are representative but infrequent, targeted augmentation when known production conditions cause errors, and synthetic data when important scenarios are difficult to capture. Adding roughly 200 images through each intervention, oversampling produced the best improvement in Hole mAP@50, increasing it from 0.135 to 0.157, while synthetic data reached 0.151; targeted brightness, blur, and rotation augmentation reduced performance to 0.050, indicating that augmentations must reflect meaningful real-world variation. Per-class weighting and focal loss can alter training emphasis but cannot replace missing visual examples, and the recommended workflow is to version datasets, retrain under consistent conditions, and compare rare-class performance after each change.

Trends Found in this Post
Trend Post Mentions Total Month Mentions Posts Companies MoM
MCP 2 2,241 148 72 -74%
Use This Data

Use this post, company, and trend context to find content marketing opportunities, perform competitive analysis, or address product feature gaps via the Plushcap MCP server or the Plushcap API.