Skip to content
Madiha Hameed Awan
Menu

All notes

Image processing · 3 September 2026

Class imbalance in medical images: accuracy is the wrong headline

Most medical image sets are unbalanced. Healthy or common cases fill the training folder; the class that matters clinically is the small one: a malignant lesion, a blast cell, a minority thyroid subtype. A model that always predicts the majority class can look strong on accuracy and still be useless. I ask students to report the class counts before they report a score.

There is no single fix. Oversampling the rare class, undersampling the common class, class-weighted losses, and focal loss each change what the optimiser sees. Synthetic augmentation—including GAN-based samples—can help only if the generated images do not copy artefacts from the few real positives. If they do, the model memorises a fake texture and fails on the next scanner.

Metrics have to match the decision. Sensitivity, specificity, precision, recall, F1, and AUC answer different questions. For a screening-style task I care about missed positives. For a confirmation-style task I care about false alarms. A confusion matrix on a held-out split, with the same preprocessing as training, is more honest than a single percentage in a slide.

This is also a supervision issue. Recent MS work I co-supervised on thyroid imaging treated class imbalance as part of the method, not as a footnote. The same discipline belongs in breast and haematology pipelines: write down the counts, the split, the loss, and the metric, and do not hide a 95 percent accuracy that never saw the rare class.

Share on LinkedIn