A vision team trains a defect detector for products on a production line, but nearly all training images are defect-free and only a handful show true defects. Which approach is commonly used to mitigate this class imbalance?
Select an answer to reveal the explanation.
Short Explanation and Infographic
Here's where imbalance bites you. If 99% of frames are fine and 1% are scrap, the model can "win" by always saying "no defect"—and your recall dies. Common fix? Give the minority class more airtime: oversample those rare defect images and augment them (flips, crops, color jitter, synthetic variants) so training sees defects more often and more diversely. Linear regression isn't the hero here. Shrinking layers doesn't rebalance labels. Transfer learning is great, but it doesn't magically invent more defect examples. Exam trap: confusing "better backbone" with "fixed class counts." Boss walks in worried about missed defects—talk oversampling, augmentation, class weights, and careful validation. Got it? Focus on the rare class.
Full explanation below image
Full Explanation
Class imbalance is common in industrial computer vision: normal products dominate, while true defects are scarce. Models trained on such data tend to bias toward the majority class because that strategy minimizes average loss, which can produce high accuracy yet poor detection of the rare, business-critical failures. A widely used remediation is to increase the effective frequency and diversity of the minority class through oversampling and data augmentation. Oversampling repeats or reweights minority examples so each training epoch exposes the optimizer to more defect instances. Augmentation applies label-preserving transforms—geometric changes, photometric jitter, noise, or carefully controlled synthetic defects—so the model generalizes beyond the few original defect photographs rather than memorizing them.
Alternative answers often sound technical but miss the imbalance problem. Replacing a modern detector with linear regression over pixels rarely captures the hierarchical visual patterns needed for subtle manufacturing flaws and does not rebalance classes. Reducing network depth lowers capacity and may underfit; it does not correct skewed label frequencies. Transfer learning from a pretrained backbone is frequently beneficial for feature reuse and sample efficiency, but it is not a complete substitute for addressing minority-class scarcity. Teams usually combine transfer learning with imbalance techniques rather than assuming pretrained weights alone solve rare-event detection.
Additional best practices include class-weighted losses, focal loss variants, hard-negative mining, stratified sampling, anomaly-detection framing when positives are extremely rare, and evaluation metrics that emphasize recall, precision, F1, or PR-AUC instead of accuracy alone. Always apply the same validation policy to avoid leakage from augmented copies of the same source image into both train and test. For exams, when the stem stresses few defect images versus many clean ones, oversampling the minority class and/or augmenting defect examples is the direct, standard response.