Early Detection and Multi-class Classification of Pigmented Skin Lesions Using Deep Learning and Explainable AI
Abstract
Pigmented skin lesions must be detected early and accurately: the chances of survival from melanoma are greater than 90% if it is detected early. Manual dermoscopic analysis is, however, time-consuming and subjective. In this paper, the authors propose a novel network-level fusion deep learning model with Explainable Artificial Intelligence (XAI) for explaining its predictions, applying DenseNet-201, ResNet-50, and Swin Transformer networks in a novel fused architecture. We propose a pre-processing pipeline for the HAM10000 dataset of 10,015 dermoscopic images from seven different diagnostic classes, including the DullRazor algorithm for hair artifact removal, the CLAHE algorithm for contrast enhancement, and the Gray World algorithm for color normalization. Stratified sampling is used for class imbalance, and three architectures are aggregated using a weighted soft-voting ensemble strategy (DenseNet-201: 0.2, ResNet-50: 0.2, and Swin-Transformer: 0.6). The proposed ensemble achieves an accuracy of 96.29% and precision, recall, and F1 scores of 0.96. Each model is trained and tested with the same architecture settings and under the same pre-processing and optimization parameters, and the improvements over each model are statistically validated with McNemar's test, yielding the highest single model performance of DenseNet-201, ResNet-50, and Swin-Transformer. The area-under-the-curve value of the receiver operating characteristic analysis ranges from 0.99 to 1.00 per class, and the accuracy per class is 100% for the vascular lesion and dermatofibroma classes, whereas the benign keratosis and melanoma classes are still a bit more difficult to distinguish. The proposed ensemble achieves competitive accuracy compared with previously reported skin lesion classification methods, with the added value of providing a spatially localized visual explanation, which is not provided by most of the previous algorithms. Grad-CAM++ heatmaps reveal the regional extent of the lesion, with highly activated regions indicating areas that contributed more strongly to the prediction. This visualization can help focus attention on lesion-related regions, although it does not by itself eliminate workstation- or user-induced artifacts. The results suggest that the framework could serve as a tool for dermatologists to aid in clinical decision-making, but it needs to be validated across other datasets and imaging scenarios.