Complexity-Aware Explainable Deep Learning for Skin Cancer Classification: A Dynamic Explanation Selector for Adaptive XAI on Dermoscopic Images

Skin cancer is among the most rapidly increasing malignancies worldwide, and early, accurate diagnosis is critical to improving patient survival. Conventional diagnosis relies on visual examination by dermatologists, a process that is time-consuming, subjective, and highly dependent on clinical expertise. Automated detection is further complicated by the inherent variability of dermoscopic images, including ambiguous lesion boundaries, heterogeneous colors and shapes, low contrast, and artifacts such as hair and shadows. This paper presents an automated, explainable deep learning framework for skin cancer classification from dermoscopic images. Three convolutional neural network architectures, including ResNet50, DenseNet121, and EfficientNetB3 are evaluated using transfer learning and data augmentation on the benchmark HAM10000 dataset, with EfficientNetB3 achieving the strongest performance among the three, reaching an overall test accuracy of 92% (weighted F1-score 0.92). To address the opacity of deep learning predictions, the framework integrates three Explainable AI (XAI) techniques: Score-CAM, Saliency Maps, and LIME and also introduces a Dynamic Explanation Selector (DES) that automatically identifies the most suitable explanation method for a given image based on a computed visual complexity score derived from edge density, texture contrast, color variation, and entropy. Feature separability across lesion classes is further examined using t-SNE visualization. Experimental results demonstrate that the proposed framework achieves high classification accuracy alongside interpretable, clinically meaningful visual explanations, positioning it as a promising decision-support tool for dermatological practice.