Skip to main content
QUICK REVIEW

[Paper Review] LMFLOSS: A Hybrid Loss For Imbalanced Medical Image Classification

Abu Adnan Sadi, Labib Chowdhury|arXiv (Cornell University)|Dec 24, 2022
Artificial Intelligence in HealthcareHealth Professions12 citations
TL;DR

This paper proposes LMFLOSS, a hybrid loss function that combines class distribution awareness with dynamic hard sample focusing to improve imbalanced medical image classification. By integrating large margin constraints with focal loss principles, it achieves 2%-10% relative macro-F1 improvements across three diverse medical imaging datasets, significantly boosting minority class performance.

ABSTRACT

With advances in digital technology, the classification of medical images has become a crucial step for image-based clinical decision support systems. Automatic medical image classification represents a pivotal domain where the use of AI holds the potential to create a significant social impact. However, several challenges act as obstacles to the development of practical and effective solutions. One of these challenges is the prevalent class imbalance problem in most medical imaging datasets. As a result, existing AI techniques, particularly deep-learning-based methodologies, often underperform in such scenarios. In this study, we propose a novel framework called Large Margin aware Focal (LMF) loss to mitigate the class imbalance problem in medical imaging. The LMF loss represents a linear combination of two loss functions optimized by two hyperparameters. This framework harnesses the distinct characteristics of both loss functions by enforcing wider margins for minority classes while simultaneously emphasizing challenging samples found in the datasets. We perform rigorous experiments on three neural network architectures and with four medical imaging datasets. We provide empirical evidence that our proposed framework consistently outperforms other baseline methods, showing an improvement of 2%-9% in macro-f1 scores. Through class-wise analysis of f1 scores, we also demonstrate how the proposed framework can significantly improve performance for minority classes. The results of our experiments show that our proposed framework can perform consistently well across different architectures and datasets. Overall, our study demonstrates a simple and effective approach to addressing the class imbalance problem in medical imaging datasets. We hope our work will inspire new research toward a more generalized approach to medical image classification.

Motivation & Objective

  • Address the challenge of class imbalance in medical image classification, where minority disease classes are underrepresented.
  • Improve model generalization and performance on rare disease classes without data augmentation or resampling.
  • Develop a loss function that simultaneously considers class distribution and sample difficulty (hard samples).
  • Outperform existing loss functions—such as focal loss and LDAM—on benchmark medical imaging datasets.
  • Enable more reliable AI-assisted diagnosis in clinical settings by reducing bias toward common disease classes.

Proposed method

  • Propose LMFLOSS, a hybrid loss that combines focal loss and label-distribution aware margin (LDAM) principles.
  • Incorporate a class-dependent margin term γj = C / nj^(1/4) to increase margin for minority classes based on their sample count.
  • Apply a dynamic weighting mechanism that emphasizes hard samples by increasing their loss contribution via a focusing parameter γ.
  • Use a modified cross-entropy loss with adaptive weighting: FL(p_t) = -(1 - p_t)^γ * log(p_t), tuned with γ = 1.5.
  • Integrate both class imbalance correction and hard sample focusing into a single differentiable loss function for end-to-end training.
  • Train models using standard backpropagation with LMFLOSS as the objective, evaluated on three real-world medical imaging datasets.

Experimental results

Research questions

  • RQ1Can a hybrid loss function that jointly models class distribution and sample difficulty outperform existing loss functions in imbalanced medical image classification?
  • RQ2To what extent does LMFLOSS improve macro-F1 scores on minority classes with very few training samples?
  • RQ3How does LMFLOSS compare to focal loss and LDAM loss in terms of generalization and robustness across diverse medical imaging domains?
  • RQ4Does the proposed loss function maintain strong performance on majority classes while significantly improving minority class detection?
  • RQ5Can LMFLOSS enable high-performance classification with minimal training data for rare diseases?

Key findings

  • On the ODIR-5K dataset, LMFLOSS improved macro-F1 by over 2.5% compared to cross-entropy and other baselines when using EfficientNetV2 and ResNet50.
  • On the HAM-10K dataset, LMFLOSS achieved a 3% performance gain in macro-F1, with a 9% improvement on the rarest class (DF) with only 81 training samples.
  • On the ISIC-2019 dataset, LMFLOSS achieved a 10% macro-F1 improvement over baselines when using ResNet50, and a 5% gain with EfficientNetV2.
  • For the rarest class in ODIR-5K (class H, 90 samples), LMFLOSS achieved a macro-F1 of 28.57%, significantly outperforming other methods.
  • Grad-CAM visualization confirmed that LMFLOSS-trained models focus more accurately on lesion regions, indicating better attention and interpretability.
  • In all metrics—accuracy, precision, recall, and F1—LMFLOSS outperformed cross-entropy, focal loss, and LDAM across all three datasets.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.