Researchers in China have developed a vision transformer that applies different feature-enhancement operations to different depths of the network, and report that this stage-matched design improved multi-class skin lesion classification across three public dermoscopic image datasets. The model, called HLE-ViT, achieved accuracies of 93.55 percent on HAM10000, 90.08 percent on ISIC 2019, and 80.30 percent on Derm7pt, with corresponding macro-F1 scores of 92.14, 89.72, and 74.45 percent, outperforming several representative comparison models on the principal evaluation metrics. The study, an original research article published in Frontiers in Medicine, was conducted by authors from Sichuan University of Science and Engineering and Zigong First People’s Hospital.
The motivation lies in a persistent difficulty in computer-aided dermatological diagnosis: different lesion categories often share similar visual appearances, while lesions within the same category can vary substantially. Diagnostic cues may be further obscured by hair occlusion, illumination variations, imaging artifacts, and low contrast between lesions and surrounding skin. The authors argue that existing deep learning methods, although capable of extracting discriminative representations from dermoscopic images, often fail to adequately integrate low-level fine-grained lesion cues with high-level semantic relationships and spatial structure.
HLE-ViT is built on the Global Context Vision Transformer, a hierarchical backbone that alternates local and global attention. Local multi-head self-attention partitions the feature map into non-overlapping windows and computes attention within each window, capturing fine-grained cues such as texture and boundary information. Global attention derives query tokens that interact with the keys and values of local windows, incorporating cross-window contextual information. The authors selected this backbone because its local-global, stage-wise hierarchy provides a natural setting for testing whether feature enhancement should differ between shallow and deep stages.
The central design idea rests on how representations change with depth. Shallow features retain high spatial resolution and preserve fine-grained lesion cues such as color, texture, and boundaries, but are more susceptible to background noise and imaging artifacts. Deep features encode richer category-level semantics and global lesion structure, although repeated downsampling may attenuate fine spatial and positional details. Accordingly, HLE-ViT treats the first two stages as shallow and the last two as deep, deploying distinct modules in each.
In the shallow stages, the Shallow Saliency Enhancement Module performs neuron-wise recalibration of feature responses using SimAM, a parameter-free attention mechanism that estimates each neuron’s importance from an energy function without adding learnable parameters. In the deep stages, the Deep Semantic-Coordinate Module combines two components: Multi-Token Attention, which mixes pre-softmax attention responses along the query-key and head dimensions so that each response aggregates information from neighboring token pairs and multiple heads, and Coordinate Attention, which generates height- and width-dependent weights to recalibrate spatial responses along the horizontal and vertical axes. The complete model contains 13.96 million parameters and requires 2.19 GFLOPs.
The evaluation covered three datasets that differ substantially in scale and composition: HAM10000 with 10,015 images across seven categories, ISIC 2019 with 25,331 images across eight categories, and Derm7pt with 1,011 images consolidated into five categories. All datasets were split into training, validation, and test sets at proportions of 70, 10, and 20 percent using class-stratified sampling, and all exhibit pronounced class imbalance, with nevi representing 66.9 percent of HAM10000, 50.8 percent of ISIC 2019, and 56.9 percent of Derm7pt. Online random augmentation was applied only to minority-class training samples, while validation and test sets retained their original distributions.
On HAM10000, HLE-ViT achieved accuracy, precision, recall, and F1-score of 93.55, 93.62, 91.03, and 92.14 percent, exceeding the best competing results by 2.18, 4.06, 2.36, and 3.03 percentage points respectively. It recorded the highest class-wise F1-scores across all seven categories, including 90.76 percent for actinic keratoses and intraepithelial carcinoma and 82.48 percent for melanoma. On ISIC 2019, it reached 90.08 percent accuracy and 89.72 percent macro-F1, again leading on all eight class-wise F1-scores. On Derm7pt, it achieved 80.30 percent accuracy and 74.45 percent macro-F1, improving over the original GCViT baseline by 3.79, 6.68, and 5.30 percentage points in precision, recall, and F1-score.
Comparison models, all trained by the authors under a unified setup with the same splits, preprocessing, and training configurations, included CNNs such as ResNet50, DenseNet121, and ConvNeXt-T, and transformer or hybrid models such as PiT and MobileViT-S. Results are reported as means across six random seeds, and a two-sided exact Wilcoxon signed-rank test on paired macro-F1 scores indicated statistically significant improvements over the baseline on both HAM10000 and ISIC 2019, with p-values below 0.05.
Ablation experiments quantified each component’s contribution. Adding only the shallow module raised the F1-score from 85.86 to 86.47 percent on HAM10000 without changing reported parameters or FLOPs, consistent with its parameter-free design. The deep components produced larger gains: Multi-Token Attention alone reached an F1-score of 90.04 percent on HAM10000, and combining it with Coordinate Attention into the deep module raised the score to 91.61 percent. Adding the shallow module on top yielded the complete model at 92.14 percent, a 6.28 percentage-point improvement over the baseline, with recall rising by 7.30 points.
Stage-position ablation supported the matched deployment. Placing the shallow module in deep stages reduced performance below the baseline on both datasets, while placing it in shallow stages improved results. Conversely, the deep module performed better in deep stages, although the authors note that differences in parameter counts between its shallow and deep placements mean the two configurations are not strictly parameter-matched controls. Feature-response visualizations showed more spatially coherent lesion-region responses with the shallow module in Stage 2 and with the deep module in Stage 4, and separability analysis of final deep representations showed the complete model achieved the lowest intra-class distance and the highest inter/intra ratio and silhouette score on both HAM10000 and ISIC 2019, indicating that gains arose mainly from more compact intra-class distributions rather than larger distances between class centroids.
Cross-dataset experiments tested generalization. When trained on HAM10000 and evaluated directly on ISIC 2019 without fine-tuning, accuracy fell from 93.94 to 85.21 percent and macro-F1 from 92.36 to 82.36 percent; the reverse direction yielded 84.15 percent accuracy and 82.44 percent macro-F1. Image deduplication was performed between the two datasets beforehand to reduce leakage risk. The authors interpret the retained performance as a degree of cross-dataset generalizability, while the degradation highlights the influence of distribution differences.
Misclassification patterns were consistent across datasets, concentrating among benign keratosis-like lesions, melanoma, and nevi. On HAM10000, 14.41 percent of melanoma test samples were misclassified as nevi, and on ISIC 2019 this proportion was 18.92 percent, corresponding to 171 samples. On Derm7pt, 33.33 percent of melanoma samples were misclassified as nevi. Grad-CAM visualizations showed HLE-ViT responses generally more concentrated within principal lesion regions than the baseline, though dispersed or shifted responses persisted for some visually similar categories, and case analysis suggested errors were associated with cross-class visual overlap and limited lesion information such as small size, low contrast, and hair occlusion.
The authors emphasize several limitations. The experiments used three publicly available retrospective dermoscopic datasets without independent external cohorts, multicenter data, or prospective clinical validation, so generalizability across imaging devices, acquisition protocols, and patient populations remains unestablished. Substantial confusion among visually similar categories persisted, recognition of rare classes remained difficult, and the case analysis covered only a limited set of examples, so it cannot establish causal relationships between specific visual factors and classification errors. The interpretability analyses characterize overall representation structure but do not isolate attribute-specific effects of individual components. The authors state that future work should include multicenter cohorts, prospective studies, and robustness analyses under challenging imaging conditions to determine the practical utility of the approach in real-world computer-aided skin lesion classification.
Training details add context to the reported results. All models were trained for 100 epochs with a batch size of 32 using the AdamW optimizer and a cosine annealing learning-rate schedule that included a five-epoch warm-up. During training, mixup was applied to both input samples and their labels, with the model optimized using soft-target cross-entropy on the mixed labels, and an exponential moving average of model parameters was maintained for evaluation. The best checkpoint for each run was selected by the highest macro-F1 score on the validation set.
The evaluation used macro-averaged precision, recall, and F1 scores computed with a one-vs-rest strategy, assigning equal weight to each lesion category regardless of sample size, which the authors note is relevant given the pronounced class imbalance in all three datasets. Row-normalized confusion matrices were used to identify the principal misclassification patterns. On HAM10000, 12.79 percent of benign keratosis-like lesion samples were misclassified as nevi and 5.94 percent as melanoma, while 1.94 percent of nevi samples were misclassified as melanoma.
An efficiency comparison placed the model among moderate-complexity options. HLE-ViT required 1.09 milliseconds per image on the same GPU, faster than EfficientNetV2-S, ConvNeXt-T, DenseNet121, and Conv-SdMLPMixer, although lightweight models such as MobileNetV2 and PiT were faster but less accurate. The authors caution that FLOPs reflect theoretical computational cost, while actual inference time also depends on operator types and hardware implementation, so the two measures do not always align.
The Derm7pt evaluation also involved label consolidation: nevus subtypes were grouped into one category, melanoma and its variants into another, and remaining diagnoses into a miscellaneous category, yielding 1,011 dermoscopic images.
Subject of Research: A stage-matched hierarchical enhancement framework for vision transformer-based multi-class skin lesion classification in dermoscopic images.
Article Title: HLE-ViT: a hierarchical lesion-enhanced global context vision transformer for multi-class skin lesion classification
Article References: Hua, C., Xiang, C., Li, L., & Wang, H. (2026). HLE-ViT: a hierarchical lesion-enhanced global context vision transformer for multi-class skin lesion classification. Frontiers in Medicine, 13, Article 1970213. https://doi.org/10.3389/fmed.2026.1970213
Image Credits: AI Generated
DOI: 10.3389/fmed.2026.1970213
Keywords: skin lesion classification, dermoscopy, vision transformer, HLE-ViT, HAM10000, ISIC 2019, Derm7pt, attention mechanism, deep learning, computer-aided diagnosis, feature enhancement, class imbalance, ablation study, Grad-CAM, GCViT, melanoma, cross-dataset generalization, macro-F1 score
Cite Scienmag News
Ophelia Keating. (December 6, 2026). Stage-matched vision transformer improves multi-class skin lesion classification. Scienmag. https://scienmag.com/stage-matched-vision-transformer-improves-multi-class-skin-lesion-classification/
Ophelia Keating. "Stage-matched vision transformer improves multi-class skin lesion classification." Scienmag, 6 December 2026, https://scienmag.com/stage-matched-vision-transformer-improves-multi-class-skin-lesion-classification/. Accessed 6 December 2026.
Ophelia Keating. "Stage-matched vision transformer improves multi-class skin lesion classification." Scienmag. December 6, 2026. https://scienmag.com/stage-matched-vision-transformer-improves-multi-class-skin-lesion-classification/








