Automated Multi-Class Skin Cancer Classification Using Vision Transformers
Abstract
Automated analysis of dermoscopic images can support the assessment of skin lesions; however, reliable multi-class classification remains challenging due to visual similarity among diagnoses, class imbalance, and variations across image sources. This study presents a Vision Transformer (ViT-B/16)-based pipeline for seven-class dermoscopic image classification. The proposed framework utilizes 224 × 224 input images, incorporating preprocessing techniques such as hair-artifact removal, contrast-limited adaptive histogram equalization, geometric and color augmentation, Cut Mix, and minority-class oversampling. The experimental workflow follows a reported 70% training, 15% validation, and 15% test data partition, with final evaluation performed on a test set containing 1,133 dermoscopic images. The fine-tuned ViT-B/16 model achieved an overall accuracy of 79.6%, with macro-averaged precision of 79.1%, macro-average recall of 79.1%, and macro-average F1-score of 79.0%, calculated directly from the supplied confusion matrix. Melanoma achieved the highest recall (87.1%), whereas vascular lesions showed the lowest recall (68.2%). These findings demonstrate moderate multi-class discrimination while emphasizing the need for improved minority-class handling, transparent label harmonization, patient- or lesion-level partitioning, and complete reporting of training configurations before clinical interpretation or external comparison.