MedGrad E-CLIP: Enhancing Trust and Transparency in AI-Driven Skin Lesion Diagnosis

Sadia Kamal, Tim Oates

Abstract

As deep learning models gain attraction in medical data, ensuring transparent and trustworthy decision-making is essential. In skin cancer diagnosis, while advancements in lesion detection and classification have improved accuracy, the black-box nature of these methods poses challenges in understanding their decision processes, leading to trust issues among physicians. This study leverages the CLIP (Contrastive Language-Image Pretraining) model, trained on different skin lesion datasets, to capture meaningful relationships between visual features and diagnostic criteria terms. To further enhance transparency, we propose a method called MedGrad E-CLIP, which builds on gradient-based E-CLIP by incorporating a weighted entropy mechanism designed for complex medical imaging like skin lesions. This approach highlights critical image regions linked to specific diagnostic descriptions. The developed integrated pipeline not only classifies skin lesions by matching corresponding descriptions but also adds an essential layer of explainability developed especially for medical data. By visually explaining how different features in an image relates to diagnostic criteria, this approach demonstrates the potential of advanced vision-language models in medical image analysis, ultimately improving transparency, robustness, and trust in AI-driven diagnostic systems.

1. Introduction

While deep learning models have achieved high accuracy in detecting skin cancer, their "black-box" nature remains a major barrier to clinical adoption. Physicians are often hesitant to trust a diagnosis if they cannot see the underlying reasoning. Existing explainability methods like Grad-CAM or the standard Grad E-CLIP often struggle with complex medical imagery. They tend to focus on dominant, high-activation regions while overlooking the subtle, minute textures and patterns—such as specific pigmentation variations—that are critical for an accurate clinical diagnosis. This study aims to bridge this gap by creating a model that not only classifies lesions but also visually justifies its decisions using the standard vocabulary of dermatologists.

2. Methodology

The proposed system is built upon the CLIP (Contrastive Language-Image Pretraining) architecture, a vision-language model that learns to associate images with textual descriptions in a shared embedding space.

Architecture of the CLIP-based skin lesion diagnosis system showing cross-modal interaction.

The core innovation of this work is MedGrad E-CLIP, which introduces a weighted entropy mechanism to replace standard spatial importance metrics. This mechanism involves two key components:

  • Local Entropy Calculation: The model measures the variability and complexity of pixel intensity values within local neighborhoods. High entropy indicates regions with rich, subtle information.
  • Weighted Attention: By incorporating these entropy weights into the gradient-based explanation, the model shifts its focus from merely the "most active" areas to the "most complex" areas, which often correspond to pathological features.
  • Dual-Modality Alignment: The system is trained to maximize the cosine similarity between lesion images and their corresponding clinical descriptions (e.g., "atypical pigmented," "absent streaks").

3. Experimental Setup

The study utilized two primary dermoscopic image databases for training and evaluation:

  1. PH²: A database of 200 images including common nevi, atypical nevi, and melanomas, annotated with clinical and histological diagnoses.
  2. Derm7pt: A larger dataset containing over 2,000 images tailored for computer-aided diagnosis, specifically incorporating the "7-point checklist" for malignancy.

Images were resized to 224x224 pixels, and text descriptions were pre-processed and augmented through reordering to prevent overfitting and improve the model's robustness.

4. Key Insights

  • Entropy as a Proxy for Pathology: Using entropy allows the model to identify diagnostic features that are often subtle changes in texture or color distribution. Entropy naturally highlights these complex patterns better than simple activation maps.
  • Vocabulary-Driven Diagnosis: By training on descriptive criteria (like the ABCDE rule or 7-point checklist) rather than just simple class labels, the model learns to communicate in the language of clinicians.
  • Superior Granularity: MedGrad E-CLIP excels at identifying physical attributes like shape and symmetry where previous iterations struggled. It can highlight slight variations, such as a "light brown area" outside a main lesion region, that might otherwise be ignored by standard models.

5. Results

The transition from a general pre-trained model to a fine-tuned medical model yielded dramatic performance gains. Quantitative metrics showed accuracy jumping from a baseline of 2.06% (pre-trained) to 80.08% after training on the custom skin lesion dataset, with the F1-Score improving from 0.0153 to 0.8011.

Qualitative comparison of explainability methods on Melanoma, showing MedGrad E-CLIP's precise localization.

Qualitatively, MedGrad E-CLIP produces significantly more precise and localized heatmaps compared to Grad-CAM. While Grad-CAM often highlights the entire lesion in a broad, undifferentiated "blob," MedGrad E-CLIP pinpoints specific regions corresponding to textual descriptors like "blue-gray color" or "missing pigmentation," as seen in the comparative analysis above.

6. Conclusion

MedGrad E-CLIP introduces a novel explainability layer for AI-driven skin lesion diagnosis. While the model shows superior localization, some limitations remain, such as occasional "over-explanation" where features outside the intended diagnostic regions are highlighted. Future work will involve clinical trials with dermatologists to validate the model's utility in real-world settings and the incorporation of more detailed textual annotations to further refine the entropy-weighted attention mechanism.

Summary updated

Abstract

As deep learning models gain attraction in medical data, ensuring transparent and trustworthy decision-making is essential. In skin cancer diagnosis, while advancements in lesion detection and classification have improved accuracy, the black-box nature of these methods poses challenges in understanding their decision processes, leading to trust issues among physicians. This study leverages the CLIP (Contrastive Language-Image Pretraining) model, trained on different skin lesion datasets, to capture meaningful relationships between visual features and diagnostic criteria terms. To further enhance transparency, we propose a method called MedGrad E-CLIP, which builds on gradient-based E-CLIP by incorporating a weighted entropy mechanism designed for complex medical imaging like skin lesions. This approach highlights critical image regions linked to specific diagnostic descriptions. The developed integrated pipeline not only classifies skin lesions by matching corresponding descriptions but also adds an essential layer of explainability developed especially for medical data. By visually explaining how different features in an image relates to diagnostic criteria, this approach demonstrates the potential of advanced vision-language models in medical image analysis, ultimately improving transparency, robustness, and trust in AI-driven diagnostic systems.

Empirical ResultsBrowse all benchmarks →

BenchmarkMethodMetricScoreProtocol / Evidence
Custom skin lesion dataset · test dataCLIP model (Before Training)Accuracy2.06%split: test · backbone=CLIP
Source quote
L136: Accuracy │ 2.06% │ 80.08%
Custom skin lesion dataset · test dataCLIP model (After Training)Accuracy80.08%split: test · backbone=CLIP
Source quote
L136: Accuracy │ 2.06% │ 80.08%
Custom skin lesion dataset · test dataCLIP model (Before Training)F1-Score0.0153split: test · backbone=CLIP
Source quote
L138: F1-Score │ 0.0153 │ 0.8011
Custom skin lesion dataset · test dataCLIP model (After Training)F1-Score0.8011split: test · backbone=CLIP
Source quote
L138: F1-Score │ 0.0153 │ 0.8011
Custom skin lesion dataset · test dataCLIP model (Before Training)Average CLIP Score0.3081split: test · backbone=CLIP
Source quote
L142: Average CLIP Score │ 0.3081 │ 0.9655
Custom skin lesion dataset · test dataCLIP model (After Training)Average CLIP Score0.9655split: test · backbone=CLIP
Source quote
L142: Average CLIP Score │ 0.3081 │ 0.9655
BibTeX
@misc{kamal2025medgrad,
  author = {Sadia Kamal and Tim Oates},
  title = {{MedGrad E-CLIP: Enhancing Trust and Transparency in AI-Driven Skin Lesion Diagnosis}},
  year = {2025},
  eprint = {2501.06887},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2501.06887},
}

Loading related content...

Figure