Abstract
Medical image classification often suffers from limited labeled data and severe class imbalance. This paper presents Categorical Relation-preserving Contrastive Knowledge Distillation (CRCKD), a novel framework that leverages class-guided contrastive learning and category centroids to enhance knowledge transfer from a teacher to a student model. By preserving structural relationships between categories, CRCKD addresses the challenges of high intra-class variance and low inter-class variance common in medical datasets.
Introduction
Deep learning has revolutionized medical imaging, yet practical deployment is hindered by a "triple threat": data scarcity, high variance/similarity between diseases, and significant class imbalance. Data scarcity often leads to overfitting, while the subtle morphological differences between different diseases (low inter-class variance) and the diverse manifestations of the same disease (high intra-class variance) complicate feature extraction. Furthermore, the inherent bias toward majority classes in imbalanced datasets often leaves rare diseases under-represented.
While Knowledge Distillation (KD)—where a compact "student" model learns from a more robust "teacher"—is a common solution, standard KD methods often fail in medical contexts. They typically do not account for the subtle structural relationships between medical categories or the inherent bias toward majority classes. This work introduces CRCKD to bridge this gap by ensuring the student model captures not just the final predictions, but the underlying categorical logic of the teacher.
Methodology
The CRCKD framework is built upon the Mean-Teacher architecture, where a student model learns from a teacher model defined as an exponential moving average (EMA) of the student's weights. Two primary modules are introduced to refine the distillation process:
- Class-guided Contrastive Distillation (CCD): Standard contrastive learning attempts to make an image's representation similar to itself and different from others. However, in medical imaging, this can inadvertently push apart images of the same disease. CCD utilizes class labels to guide the feature space, ensuring that all samples from the same category are "pulled" together while samples from different categories are "pushed" apart.
- Categorical Relation Preserving (CRP): This module focuses on global structural consistency. Instead of noisy sample-to-sample comparisons, CRP calculates category centroids—the average feature representation of a class. By maintaining a memory bank of these centroids, CRP stabilizes the learning process against class imbalance. The student is tasked with matching the teacher’s "relational graph," which represents how individual samples relate to these stable class-level anchors.
Experimental Evaluation
The framework was evaluated on two prominent medical benchmarks characterized by significant class imbalance:
- HAM10000: A collection of 10,015 dermoscopy images across seven types of skin lesions.
- APTOS: 3,662 fundus images used for grading diabetic retinopathy into five categories.
These datasets provide a rigorous testing ground for the CRP module's ability to handle imbalanced distributions and the CCD module's ability to resolve subtle class differences.
Results and Discussion
CRCKD consistently outperformed vanilla models and state-of-the-art KD techniques in both quantitative and qualitative metrics. On the HAM10000 dataset, the method achieved a Balanced Multi-class Accuracy (BMA) of 78.07%, a 2% improvement over the standard Mean-Teacher baseline. On APTOS, the BMA reached 71.90%, representing a significant 3.11% jump.
Qualitative analysis via relation matrices confirms that CRCKD produces much "cleaner" clusters in the feature space. By effectively reducing the confusion between similar-looking diseases compared to other methods like FitNet or Similarity-Preserving (SP) distillation, the model demonstrates a superior understanding of categorical structures.
Conclusion and Future Work
CRCKD provides a robust solution for medical image classification by integrating categorical relations into the distillation process. By using labels as a compass for contrast and centroids as anchors for stability, the method effectively mitigates the challenges of data scarcity and imbalance. While the use of memory banks adds some training complexity, the resulting student models maintain standard inference speeds, making them highly practical for clinical deployment. Future work may explore the generalization of these categorical relations to 3D volumetric data or multi-modal medical settings.
Summary updated