A weakly supervised deep learning model for OSCC diagnosis and lesion highlighting in histopathology images
Highlight box
Key findings
• A weakly supervised framework combining UNI-2 patch-level representations with self-attention-based multiple-instance aggregation achieved strong performance for image-level oral squamous cell carcinoma diagnosis. The model obtained a mean area under the curve of 0.9919 in five-fold cross-validation and 0.9992 in an independent external validation cohort, outperforming the ResNet-50-based baseline in external validation.
What is known and what is new?
• Deep learning has shown considerable potential for automated analysis of oral histopathology images. However, most available datasets provide only image-level diagnostic labels and lack region-level annotations, limiting the development of fully supervised models and the rigorous validation of spatial interpretability.
• This study integrates a pathology foundation model with weakly supervised multiple-instance learning to classify oral squamous cell carcinoma without requiring lesion-level annotations. It also provides attention-based heatmaps for exploratory assessment of model focus patterns and qualitative review of misclassified cases, while avoiding claims of verified lesion localization.
What is the implication, and what should change now?
• Pathology foundation models may provide a practical and reusable approach for developing accurate weakly supervised diagnostic systems from routinely available image-level labels. Future studies should prioritize multicenter prospective validation, slide-level evaluation, comparison with pathologists, and region-level pathological annotation to confirm clinical generalizability and spatial interpretability..
Introduction
Oral squamous cell carcinoma (OSCC) is one of the most common pathological subtypes of head and neck cancers, characterized by strong invasiveness and a high risk of recurrence and metastasis. Early identification and accurate diagnosis are therefore crucial for improving patient outcomes (1,2). Histopathological examination is the gold standard for OSCC diagnosis, relying on pathologists’ integrated assessment of morphological cues such as cellular atypia, increased mitotic activity, disorganized epithelial architecture, and invasive growth patterns. The widespread adoption of digital pathology has standardized image acquisition, storage, and sharing, thereby enabling data-driven development of deep learning-based diagnostic assistance and facilitating practical deployment scenarios (3).
Despite notable progress in deep learning-based OSCC histopathology analysis, existing studies still have several limitations that restrict direct generalization to weakly supervised and externally validated diagnostic settings (4). Yang et al. developed a customized deep learning model for OSCC detection from H&E histopathological images and further showed that model assistance could improve the diagnostic efficiency of pathologists, providing important evidence for the clinical potential of artificial intelligence (AI)-assisted OSCC diagnosis. However, this study was mainly based on a task-specific supervised diagnostic framework and did not primarily address the weakly supervised aggregation problem that arises when only image-level labels are available. In addition, the generalizability of such models across independent public cohorts remains difficult to assess when differences in image source, preprocessing, magnification, and validation protocol are present. EfficientNetSwift further demonstrated that lightweight network design can achieve high diagnostic performance for OSCC pathological image detection, with a reported accuracy of 95.3% and an area under the curve (AUC) of 0.99. Nevertheless, its major contribution lies in improving model efficiency within a conventional image-classification framework, rather than explicitly modeling heterogeneous multi-patch tissue representations or evaluating foundation-model-based weak supervision (5). Therefore, although prior OSCC studies have established the feasibility of deep learning for histopathological diagnosis, there remains a need for a framework that can operate under image-level supervision, aggregate heterogeneous patch-level information, benchmark against conventional encoders, and assess generalization on an independent external cohort (6,7).
In recent years, pathology foundation models pre-trained on large-scale histology data have emerged as a promising route to learn transferable and robust morphological representations, helping to mitigate limited annotation and distribution shift. UNI-2, as a representative pre-trained encoder, can provide high-quality patch-level semantic embeddings for downstream tasks and is often better suited to capturing tissue architecture and cellular morphology than conventional vision backbones trained from scratch (8,9). Nevertheless, strong representations alone do not automatically translate into reliable image-level decision-making and spatial interpretability, particularly in the presence of multi-patch inputs. Aggregation strategies play a decisive role in both performance and interpretability. Simple pooling is often insufficient to capture contextual relationships across regions, whereas self-attention can explicitly model instance dependencies and emphasize discriminative information, offering a natural interface for generating heatmap-based lesion highlighting aligned with model decisions.
Taken together, we construct a weakly supervised framework that integrates UNI-2 pathology representations with self-attention multiple-instance aggregation for OSCC diagnosis and lesion highlighting (Figure 1), while implementing ResNet-50 feature extraction as a baseline comparator to quantify the benefit of foundation representations. The proposed method is trained end-to-end with image-level labels and produces both diagnostic predictions and spatial evidence without introducing additional fine-grained annotation costs. This work enhances interpretability and traceability, and it establishes a methodological foundation for subsequent cross-dataset validation and extension to real-world clinical scenarios. We present this article in accordance with the TRIPOD reporting checklist (available at https://tcr.amegroups.com/article/view/10.21037/tcr-2026-0470/rc).
Methods
Data sources and study design
This study performed weakly supervised binary classification to distinguish OSCC from normal tissue using two publicly available histopathology image datasets. Both datasets provide image-level labels only and do not include pixel- or region-level lesion annotations; therefore, a multiple-instance learning (MIL) paradigm was adopted. The training and internal validation data were obtained from the OSCC-Normal dataset hosted on the Kaggle platform (https://www.kaggle.com/datasets/mangalmanan/oscc-normal). This dataset comprised 5,192 histopathology images, including 2,494 normal images and 2,698 OSCC images, corresponding to 48.0% and 52.0% of the dataset, respectively. The overall class distribution was relatively balanced. To preserve the original class proportions during model evaluation, five-fold stratified cross-validation was performed, ensuring comparable distributions of normal and OSCC samples across the training and validation subsets.
The external validation data were obtained from a publicly released Mendeley Data dataset (https://data.mendeley.com/datasets/ftmp4cvtmb/1) and were used to assess generalization on an independent cohort. This external validation set included 528 histopathology images, comprising 89 normal images and 439 OSCC images. Unlike the relatively balanced training and internal validation dataset, the external validation cohort showed an OSCC-predominant class distribution, thereby providing an additional assessment of model robustness under a different data distribution.
During training and internal validation, we conducted five-fold stratified cross-validation on the Kaggle dataset to preserve the class distribution of normal and OSCC in each fold. In each fold, four folds were used for training and one fold was used for validation. The epoch achieving the best performance on the validation split was selected as the “best model” for that fold and used for cross-validation performance reporting. External validation was performed as a one-time evaluation on the Mendeley dataset only and did not involve any training, hyperparameter tuning, or threshold selection, ensuring independence and objectivity of the external test. This study was conducted in accordance with the Declaration of Helsinki and its subsequent amendments.
Model framework and feature encoders
We formulated OSCC histopathology recognition as a weakly supervised MIL problem. Specifically, each image was treated as a “bag” consisting of multiple local patches (instances), and image-level predictions were obtained via patch-level feature extraction followed by instance aggregation. The overall pipeline comprised four core steps: patch partitioning, patch feature encoding, self-attention MIL aggregation, and binary classification output. Briefly, each input histopathology image was divided into a set of patches, and a high-dimensional embedding was extracted for each patch. All patch embeddings were then fed as a sequence into a self-attention aggregation module to model inter-instance dependencies and learn an image-level discriminative representation, which was subsequently used to output the OSCC probability and the final binary prediction.
To examine the impact of representational capacity on weakly supervised learning, we evaluated two patch-level feature encoders. The first encoder was the pathology foundation model UNI-2 (UNI2-h), used as a domain-pretrained representation encoder, with weights obtained from the Hugging Face repository (https://huggingface.co/MahmoodLab/UNI2-h). The second encoder was ResNet-50 as a baseline feature extractor, initialized with ImageNet-1k pretrained weights provided by timm, corresponding to the Hugging Face model page (https://huggingface.co/timm/resnet50.a1_in1k). Both encoders took patches as input and produced fixed-dimensional feature vectors as instance embeddings. Downstream, the same self-attention MIL aggregator and classification head were used for training and evaluation to ensure fair comparison.
For instance aggregation, we employed a multi-head self-attention module to perform contextual modeling over the patch sequence, enabling the model to integrate discriminative cues from multiple local regions at a global level. This design is practically relevant for OSCC, where diagnostic evidence is often heterogeneous and spatially distributed, such as unevenly distributed tumor nests, dispersed cues at the invasive front, and coexisting stromal reactions and inflammatory infiltrates. The aggregated image-level representation was passed to a lightweight fully connected classifier to produce logits, and class probabilities were obtained via softmax. To improve interpretability, attention responses were further used to generate heatmaps by mapping highly responsive patches back to the original image space, providing spatial evidence supporting the model’s decisions.
Training strategy and evaluation metrics
The model was trained end-to-end using the cross-entropy loss. For each fold, training was performed for a fixed number of epochs (e.g., 100 epochs), and loss and accuracy on both the training and validation sets were monitored to assess convergence behavior and potential overfitting. Performance was evaluated using multiple complementary metrics, including accuracy, AUC, F1 score, Matthews correlation coefficient (MCC), and precision, treating OSCC as the positive class. External validation computed the same metrics on the independent dataset and additionally reported ROC curves and confusion matrices to characterize discrimination ability and error distribution in the external cohort.
Image preprocessing, patch tiling, and multi-instance bag construction
The training and internal validation data in this study were obtained from the publicly available OSCC-Normal histopathological image dataset hosted on the Kaggle platform. The external validation data were obtained from the publicly released Mendeley Data dataset titled “A histopathological image repository of normal epithelium of Oral Cavity and Oral Squamous Cell Carcinoma”. The Mendeley Data dataset contains 1,224 H&E-stained histopathological images and is divided into 100× and 400× magnification subsets. The 100× subset includes 89 images of normal oral epithelium and 439 images of OSCC, whereas the 400× subset includes 201 images of normal oral epithelium and 495 images of OSCC. In the present study, the Kaggle OSCC-Normal dataset was used for model training and five-fold internal validation, while the 100× subset from the Mendeley Data dataset was used as an independent external validation cohort to evaluate model generalizability across different public data sources.
All histopathological images underwent a unified preprocessing and tiling workflow before model input. First, the original images were processed using the Trident framework for tissue region detection, background exclusion, image tiling, and patch coordinate generation. Because the Kaggle and Mendeley public images did not provide traceable and consistent scanner-derived physical resolution metadata, the exact micrometers per pixel could not be reliably recovered for each image. Therefore, we did not assign an absolute MPP value. Instead, the analysis was performed based on the original magnification information provided by the datasets and a unified pixel-level tiling strategy. Specifically, all images were divided into patches of 256×256 pixels, with a tiling stride of 256 pixels and a tiling overlap of 0 pixels. This setting ensured that all patches had a consistent input pixel size before feature extraction while avoiding redundant information between adjacent patches.
To reduce the influence of blank background and non-tissue regions on feature extraction and MIL, background exclusion was performed during the tiling stage. Trident first generated tissue masks based on image color and tissue region information, and only patch coordinates located within valid tissue masks were retained. Patches mainly composed of blank background, slide edges, or obvious non-tissue regions were excluded from subsequent feature extraction. Apart from tissue mask filtering by Trident, no additional manual background threshold was applied during feature file loading. After background exclusion, the retained valid patches from each image were separately fed into the UNI-2 and ResNet-50 feature extractors to generate patch-level feature vectors. Subsequently, all patch features derived from the same image were organized into a multi-instance bag for weakly supervised image-level classification.
No additional stain normalization was applied in this study. This strategy preserved the original HE staining distribution of the public datasets and allowed the model to be evaluated under raw color variation and cross-dataset conditions. However, the absence of stain normalization also means that model performance may be affected by differences in data source, staining intensity, microscope acquisition conditions, and image processing workflows. Therefore, an independent external validation cohort was further included to assess model generalizability across datasets, and staining variation was considered in the “Discussion” as a potential factor affecting cross-dataset stability.
Feature extraction, MIL architecture, and training parameters
During feature extraction, each valid patch was separately fed into the UNI-2 pathology foundation model and the ResNet-50 baseline model to obtain patch-level feature representations. The output feature dimension was 1,536 for UNI-2 and 1,024 for ResNet-50. For each image, all valid patch features were aggregated according to their source image to construct a multi-instance bag. Because different images contained different numbers of valid patches, patch features were padded during batch construction, and a corresponding mask matrix was generated to distinguish real patches from padded positions. Subsequent attention modeling and pooling operations were applied only to valid patch features, thereby preventing padded regions from affecting the image-level representation.
The image-level classification model adopted a multi-head self-attention-based MIL architecture. The input feature dimension was 1,536 for the UNI-2 model and 1,024 for the ResNet-50 model. The multi-head self-attention module used 8 attention heads and adopted a batch-first input format to model dependencies among patches within each bag. To reduce GPU memory consumption caused by large-scale patch inputs, attention computation was performed in segments of 1,000 patches, and the segmented outputs were subsequently concatenated to reconstruct the complete patch sequence representation. For valid patches, the model used the mask matrix to remove the influence of padded positions, and masked mean pooling was applied to aggregate the attention-enhanced patch features into a single compact image-level representation. This image-level representation was then passed through two fully connected layers and a final classification layer. The first fully connected layer mapped the feature representation to 512 dimensions, and the second mapped it to 128 dimensions. Both layers were followed by Batch normalization and LeakyReLU activation. The final classifier output binary logits for Normal and OSCC.
The model was trained using cross-entropy loss as the optimization objective. AdamW was used as the optimizer, with an initial learning rate of 1×10−4 and a weight decay of 3×10−3. The learning rate was scheduled using CosineAnnealingLR, with a maximum training epoch of 100 and a minimum learning rate of 1×10−6. The training batch size was 4, and 4-step gradient accumulation was applied, resulting in an effective batch size of 16. Automatic mixed precision was used during training to improve computational efficiency. No additional dropout layer was used in the model. Overfitting was mainly controlled through AdamW weight decay, Batch Normalization, five-fold stratified cross-validation, and selection of the optimal checkpoint based on validation AUC. Each fold was trained independently, and the model with the highest validation AUC was saved as the best checkpoint for that fold.
Statistical analysis
Model performance was evaluated using accuracy, the area under the receiver operating characteristic curve (AUC), F1 score, Matthews correlation coefficient (MCC), and precision. For internal evaluation, five-fold stratified cross-validation was performed, and the performance metrics obtained from the five validation folds were summarized as the mean and standard deviation. The model checkpoint with the lowest validation loss was selected within each fold for performance evaluation.
For the independent external validation cohort, balanced accuracy, AUC, macro-averaged F1 score, MCC, and class-specific precision and recall were calculated to account for the imbalanced distribution of Normal and oral squamous cell carcinoma images. The 95% confidence intervals for all external validation metrics were estimated using nonparametric bootstrap resampling with 1,000 valid replicates. In each bootstrap replicate, observations from the external validation cohort were sampled with replacement, and the corresponding performance metrics were recalculated. UNI-2 and ResNet-50 were evaluated on the same external validation cohort using an identical evaluation procedure.
Results
Overall performance under five-fold cross-validation
To assess the training stability and generalization of the proposed weakly supervised deep learning model, each fold was trained for 100 epochs, and the loss and accuracy curves on the training and validation sets were recorded to characterize optimization dynamics and inter-fold consistency (Figure 1).
Under the UNI-2 feature setting (Figure 2A,2B), training loss decreased rapidly during early epochs, followed by a stable plateau with mild fluctuations. Validation loss remained low and stabilized without sustained escalation or divergence, indicating good generalization stability across folds. Both training and validation accuracies increased quickly with epoch progression and approached 1 in later epochs, with highly consistent trends across folds, suggesting that UNI-2 pathology foundation representations effectively support discriminative learning between OSCC and normal samples under weak supervision. Under the ResNet-50 baseline feature setting (Figure 2C,2D), the model also converged clearly and accuracy similarly approached 1, implying that the task is highly separable under the current data configuration. Compared with UNI-2, ResNet-50 exhibited slightly larger fluctuations in several folds and less smooth convergence, suggesting higher sensitivity to fold partitioning and morphological heterogeneity. Collectively, Figure 1 indicates that both encoders enable near-saturated accuracy with stable loss decay, while UNI-2 yields smoother learning dynamics and better inter-fold consistency, motivating subsequent reporting of more comprehensive metrics (AUC, F1, MCC, and precision) and interpretability analyses.
Best-fold performance summary and learning-curve consistency
For quantitative comparison, the epoch achieving the best validation performance within each fold was selected as the “best model” of that fold. We summarized best loss, best accuracy (Acc), best AUC, best F1, best MCC, and best precision for UNI-2 and ResNet-50 (Tables 1,2). In addition, we plotted learning curves for AUC, F1, MCC, and precision on the training and validation sets, together with cross-fold variability bands (Figure 2), to evaluate convergence speed, stability, and fold-to-fold reproducibility.
Table 1
| Fold | Best_epoch | Loss | Acc | AUC | F1 | MCC | Precision |
|---|---|---|---|---|---|---|---|
| 1 | 27 | 0.1234 | 0.9663 | 0.9917 | 0.9680 | 0.9327 | 0.9566 |
| 2 | 84 | 0.0875 | 0.9711 | 0.9951 | 0.9725 | 0.9423 | 0.9636 |
| 3 | 16 | 0.1325 | 0.9644 | 0.9910 | 0.9659 | 0.9287 | 0.9597 |
| 4 | 11 | 0.1430 | 0.9557 | 0.9916 | 0.9572 | 0.9113 | 0.9607 |
| 5 | 85 | 0.0927 | 0.9672 | 0.9948 | 0.9683 | 0.9345 | 0.9738 |
Acc, accuracy; AUC, area under the curve; MCC, Matthews correlation coefficient.
Table 2
| Fold | Best_epoch | Loss | Acc | AUC | F1 | MCC | Precision |
|---|---|---|---|---|---|---|---|
| 1 | 28 | 0.1503 | 0.9576 | 0.9919 | 0.9584 | 0.9161 | 0.9687 |
| 2 | 83 | 0.0946 | 0.9701 | 0.9850 | 0.9712 | 0.9302 | 0.9721 |
| 3 | 52 | 0.1281 | 0.9595 | 0.9902 | 0.9506 | 0.9192 | 0.9615 |
| 4 | 79 | 0.1319 | 0.9595 | 0.9865 | 0.9600 | 0.9204 | 0.9663 |
| 5 | 87 | 0.1570 | 0.9441 | 0.9833 | 0.9458 | 0.8882 | 0.9530 |
Acc, accuracy; AUC, area under the curve; MCC, Matthews correlation coefficient.
With UNI-2 representations (Table 1), the model achieved consistently high performance across the five folds. The best accuracy ranged from 0.9557 to 0.9711, AUC from 0.9910 to 0.9951, F1-score from 0.9572 to 0.9725, MCC from 0.9113 to 0.9423, and precision from 0.9566 to 0.9738. The cross-fold mean performance was 0.9649±0.0057 for accuracy, 0.9928±0.0019 for AUC, 0.9664±0.0057 for F1-score, 0.9299±0.0115 for MCC, and 0.9629±0.0066 for precision, with a mean best loss of 0.1158±0.0246. The best-performing epochs varied from epoch 11 to epoch 85, indicating that the optimal checkpoints were selected at different training stages across folds. Although fold 4 showed the lowest accuracy and MCC among the five folds, its AUC remained above 0.99, suggesting that the UNI-2-based model maintained strong discriminative ability even in the relatively more challenging split.
With ResNet-50 representations (Table 2), the model also achieved favorable performance, but with lower overall values and greater cross-fold variability than UNI-2. The best accuracy ranged from 0.9441 to 0.9701, AUC from 0.9833 to 0.9919, F1-score from 0.9458 to 0.9712, MCC from 0.8882 to 0.9302, and precision from 0.9530 to 0.9721. The cross-fold mean performance was 0.9582±0.0093 for accuracy, 0.9874±0.0036 for AUC, 0.9572±0.0097 for F1-score, 0.9148±0.0158 for MCC, and 0.9643±0.0074 for precision, with a mean best loss of 0.1324±0.0244. Compared with UNI-2, ResNet-50 showed lower mean accuracy, AUC, F1-score, and MCC, together with larger standard deviations for most metrics. The largest performance reduction was observed in fold 5, where ResNet-50 achieved an accuracy of 0.9441 and an MCC of 0.8882. These results suggest that UNI-2 provided a more stable and robust feature representation for weakly supervised OSCC histopathology classification.
The learning curves corroborated the tabulated findings (Figure 3). For UNI-2 (Figure 3A-3D), validation AUC and precision reached high levels early and remained stable; F1 and MCC also increased rapidly and plateaued, with narrower cross-fold variability bands, indicating faster convergence and stronger inter-fold consistency. For ResNet-50 (Figure 3E-3H), the metrics also approached saturation but exhibited more pronounced fold-to-fold variability, particularly for MCC and F1, consistent with the larger standard deviations in Table 2.
Overall discrimination and error-pattern analysis
To further characterize discriminative ability and error structures at the overall level, we summarized ROC curves and confusion matrices for both encoder settings (Figure 3). Importantly, the confusion-matrix counts in Figure 3 substantially exceed the number of original images, reflecting an overall aggregation of fine-grained instance-level outputs rather than image-level totals, which helps reveal error patterns and potential class biases.
For UNI-2 (Figure 4A-4C), the ROC curve rose steeply and closely approached the top-left corner, yielding an overall AUC of 0.9919 (Figure 4A). The confusion matrix showed 2,393 true negatives, 101 false positives, 81 false negatives, and 2,617 true positives (Figure 4B). After normalization, the recall was 0.96 for normal and 0.97 for OSCC (Figure 4C), corresponding to an overall accuracy of approximately 0.965. These results indicate that the UNI-2-based model achieved strong discrimination and maintained a relatively balanced classification performance for both normal and OSCC samples.
For ResNet-50 (Figure 4D-4F), the ROC curve also showed high discriminative ability, with an overall AUC of 0.9899 (Figure 4D). The confusion matrix showed 2,421 true negatives, 73 false positives, 144 false negatives, and 2,554 true positives (Figure 4E). The normalized matrix indicated a recall of 0.97 for normal and 0.95 for OSCC (Figure 4F), corresponding to an overall accuracy of approximately 0.958. Compared with ResNet-50, UNI-2 produced fewer total errors and markedly fewer OSCC false-negative predictions, although ResNet-50 showed slightly fewer false-positive predictions among normal samples. Overall, these findings suggest that UNI-2 provides a more favorable operating profile for OSCC diagnosis, particularly by reducing missed OSCC cases while maintaining high overall discrimination.
Exploratory heatmap visualization of model attention patterns
To provide a qualitative view of the model’s decision process, we visualized attention/response heatmaps for representative OSCC cases (Figure 5A-5D). Because pixel-level or region-level lesion annotations were not available in the present dataset, these heatmaps were interpreted as exploratory visualization results rather than quantitative evidence of lesion localization. Overall, high-response regions (red/yellow) provided a visual indication of image areas that contributed more strongly to the model prediction. In several correctly classified OSCC cases, high-response signals appeared near regions with visually suspicious histomorphological patterns, such as increased cellular density, nuclear atypia, disorganized epithelial architecture, or tumor-like epithelial aggregates. High-confidence predictions tended to show relatively compact response patterns, whereas lower-confidence cases showed more diffuse heatmap distributions. These qualitative observations suggest that attention/response heatmaps may provide a useful interface for reviewing model focus patterns. However, in the absence of region-level annotations, the spatial correspondence between heatmap signals and true OSCC lesions cannot be rigorously validated and should not be interpreted as definitive lesion-level evidence.
To further evaluate the decision-making basis of the model in incorrectly classified cases, we performed heatmap visualization analysis on representative misclassified samples. Figure 6A-6D shows normal and OSCC cases that were misclassified by the model with high confidence, comparing the original images with the heatmap overlays corresponding to the predicted class. For normal tissue samples incorrectly predicted as OSCC, the high-response regions were mainly distributed in the superficial squamous epithelium and areas with local keratinization or dense cellular arrangement. This suggests that the model may have misinterpreted keratinization, variations in cellular density, or staining differences in some normal squamous epithelial regions as OSCC-related morphological features, thereby resulting in false-positive predictions (Figure 6A,6B). For OSCC samples incorrectly predicted as normal tissue, the heatmaps showed that the model assigned higher normal-class probabilities to regions with relatively preserved tissue architecture, less evident atypia, or limited tumor components. In some samples, the small tissue area, extensive background region, or atypical lesion morphology may have weakened the model’s ability to recognize tumor-related features, leading to false-negative predictions (Figure 6C,6D).
These misclassified cases indicate that, although the UNI-2 model combined with weakly supervised MIL achieved favorable overall diagnostic performance, it may still be affected by local histomorphological similarity, image quality, tumor-region proportion, and histological heterogeneity. Heatmap analysis of misclassified cases not only helps reveal the potential basis of model predictions but also suggests that future model optimization may benefit from incorporating more borderline cases, low-tumor-burden cases, and morphologically similar normal epithelial samples during training, thereby further improving the robustness and interpretability of the model in complex histological scenarios.
External validation performance and UNI-2 confusion-matrix analysis
To assess generalization performance on an independent cohort, we evaluated the proposed model on the external validation dataset described above. The UNI-2-based model showed strong generalization performance (Table 3 and Figure 7A-7C). The ROC curve closely approached the top-left corner, with an AUC of 0.9992 (95% CI: 0.9980–0.9999). The confusion matrix showed 81 true normal cases, 8 normal cases misclassified as OSCC, 3 OSCC cases misclassified as normal, and 436 correctly predicted OSCC cases. Accordingly, UNI-2 achieved a balanced accuracy of 0.9516 (95% CI: 0.9213–0.9811), macro-F1 of 0.9620 (95% CI: 0.9389–0.9833), and MCC of 0.9245 (95% CI: 0.8787–0.9667). Class-wise analysis further showed a normal recall of 0.9101 and an OSCC recall of 0.9932, indicating that the model maintained very high OSCC sensitivity while preserving good recognition of the minority normal class.
Table 3
| Metric | N_bootstrap_valid | UNI-2 (formatted) | ResNet-50 (formatted) |
|---|---|---|---|
| Balanced_acc (95% CI) | 1,000 | 0.9516 (0.9213–0.9811) | 0.7584 (0.7070–0.8059) |
| AUC (95% CI) | 1,000 | 0.9992 (0.9980–0.9999) | 0.9564 (0.9324–0.9743) |
| Macro_F1 (95% CI) | 1,000 | 0.9620 (0.9389–0.9833) | 0.8077 (0.7561–0.8518) |
| MCC (95% CI) | 1,000 | 0.9245 (0.8787–0.9667) | 0.6492 (0.5576–0.7278) |
| Precision_normal (95% CI) | 1,000 | 0.9643 (0.9221–1.0000) | 0.9038 (0.8135–0.9783) |
| Recall_normal (95% CI) | 1,000 | 0.9101 (0.8494–0.9674) | 0.5281 (0.4253–0.6236) |
| Precision_OSCC (95% CI) | 1,000 | 0.9820 (0.9696–0.9933) | 0.9118 (0.8865–0.9356) |
| Recall_OSCC (95% CI) | 1,000 | 0.9932 (0.9842–1.0000) | 0.9886 (0.9774–0.9977) |
The data in parentheses are 95% confidence intervals. AUC, area under the curve; CI, confidence interval; MCC, Matthews correlation coefficient; OSCC, oral squamous cell carcinoma.
In contrast, ResNet-50 showed reduced external validation performance, particularly for normal samples (Table 3 and Figure 7D-7F). Although the model retained a high OSCC recall of 0.9886, its normal recall decreased to 0.5281, with 42 of 89 normal cases misclassified as OSCC. The overall AUC was 0.9564 (95% CI: 0.9324–0.9743), while balanced accuracy, macro-F1, and MCC were 0.7584 (95% CI: 0.7070–0.8059), 0.8077 (95% CI: 0.7561–0.8518), and 0.6492 (95% CI: 0.5576–0.7278), respectively. Compared with ResNet-50, UNI-2 achieved higher AUC, balanced accuracy, macro-F1, and MCC, and substantially improved normal-class recall without compromising OSCC sensitivity. These findings suggest that pathology foundation model-derived representations provide stronger robustness under external distribution shift, especially in class-imbalanced validation settings.
To further contextualize the model performance from a clinical diagnostic perspective, we performed a reference-based comparison between the diagnostic results of our models and the pathologist performance reported in a previous study. Yang et al. reported the diagnostic performance of pathologists with different levels of experience in a deep learning study of OSCC histopathological diagnosis, including junior pathologists, senior pathologists, and a chief pathologist. The reported sensitivity of the pathologists ranged from 0.88 to 0.98, the F1-score ranged from 0.89 to 0.96, and the AUC ranged from 0.89 to 0.96. In comparison, the UNI-2 model in the present study achieved a sensitivity of 0.99, an F1-score of 0.98, and an AUC of 0.99, showing overall superior performance to the ResNet-50 model and numerically exceeding the pathologist performance reported in the previous study (Table 4). These results suggest that the model based on UNI-2 feature extraction and weakly supervised MIL has strong discriminative ability for distinguishing OSCC from normal histopathological images and shows potential value as an auxiliary diagnostic tool for OSCC. It should be noted that this comparison was based on pathologist data from a previously published study rather than on a prospective pathologist reader study conducted on the validation set of the present study. Therefore, the comparison should be interpreted as a reference-based contextual comparison rather than a strict head-to-head comparison between pathologists and the model on the same cohort.
Table 4
| Diagnostician/model | Sensitivity | F1-score | AUC |
|---|---|---|---|
| Junior pathologist 1 | 0.96 | 0.96 | 0.96 |
| Junior pathologist 2 | 0.98 | 0.89 | 0.89 |
| Junior pathologist 3 | 0.88 | 0.90 | 0.91 |
| Senior pathologist 1 | 0.92 | 0.92 | 0.92 |
| Senior pathologist 2 | 0.92 | 0.93 | 0.94 |
| Senior pathologist 3 | 0.94 | 0.94 | 0.95 |
| Chief pathologist | 0.92 | 0.94 | 0.95 |
| UNI-2 | 0.99 | 0.98 | 0.99 |
| ResNet-50 | 0.98 | 0.94 | 0.95 |
AUC, area under the curve; DL, deep learning; OSCC, oral squamous cell carcinoma.
Discussion
In this study, we developed a weakly supervised deep learning framework for image-level OSCC diagnosis on digitized histopathology images by combining pathology foundation model representations derived from UNI-2 with self-attention-based multiple-instance aggregation. Across five-fold cross-validation and an independent external validation cohort, the UNI-2-based model achieved strong diagnostic performance, with a mean cross-validation AUC of 0.9919 and an external validation AUC of 0.9992. These results were higher than those of the ResNet-50 baseline, which achieved a mean cross-validation AUC of 0.9899 and an external validation AUC of 0.9564. The consistently high accuracy, AUC, F1-score, MCC, and precision indicate that the proposed framework provides robust image-level discrimination beyond simple accuracy-based evaluation.
A key observation is that, although both UNI-2 and the conventional baseline encoder ResNet-50 achieved high performance in this binary classification setting, UNI-2 provided a more stable and consistent performance profile. This may be attributable to the richer morphological priors encoded by pathology foundation models pre-trained on large and diverse histology corpora. Under weak supervision, where only image-level labels are available, such representations may help reduce the influence of non-specific background patterns, staining heterogeneity, and variable tumor proportions. Compared with conventional vision backbones, foundation model-derived patch embeddings may therefore provide a more informative basis for downstream multiple-instance aggregation and improve robustness when the data distribution varies across folds or validation cohorts (10).
The external validation results further support the generalizability of the proposed framework. The UNI-2-based model maintained high discriminative ability on the independent external cohort, whereas the performance gap between UNI-2 and ResNet-50 became more apparent in this setting. This finding suggests that the advantage of pathology-specific foundation representations may be more evident when the model is evaluated beyond the development dataset. Nevertheless, the remaining misclassified cases indicate that strong global performance does not eliminate clinically relevant failure modes. False-positive predictions in normal samples may be related to reactive epithelial changes, inflammatory alterations, epithelial hyperplasia, keratinization patterns, or staining and processing variations that share local visual similarity with tumor-associated regions. False-negative predictions may occur when malignant foci occupy only a small fraction of the image, are located near the periphery, or show subtle or heterogeneous morphology (11). These observations support the need for systematic error analysis and human-in-the-loop review, particularly for cases with borderline prediction probabilities or diagnostically ambiguous histological patterns.
To address the insufficient benchmarking against OSCC-specific deep learning methods, we further performed a literature-based reference comparison between our proposed model and previously published methods for OSCC histopathological image diagnosis. Previous studies have proposed various deep learning frameworks for OSCC pathological image diagnosis, including convolutional neural network-based models, the lightweight EfficientNetSwift model, OralNet, and attention-based MIL approaches (12,13). These studies have demonstrated the value of deep learning for OSCC-assisted diagnosis from different perspectives. For example, Yang et al. developed a deep learning model for OSCC histopathological image diagnosis and reported high sensitivity, specificity, and F1-score on an independent test set. EfficientNetSwift, as a lightweight model for OSCC pathological image detection, also reported high accuracy and AUC. In addition, attention-based MIL methods have provided an important methodological foundation for weakly supervised histopathological image analysis.
Compared with these studies, the core difference of the present study lies in the use of the UNI-2 pathology foundation model for patch-level feature extraction, combined with weakly supervised MIL and multi-head self-attention for image-level diagnostic modeling. Without relying on pixel-level or region-level manual annotations, the UNI-2 model achieved a sensitivity of 0.99, an F1-score of 0.98, and an AUC of 0.99, outperforming the ResNet-50 baseline model in the present study and showing performance comparable to the high-level results reported by previous OSCC-specific deep learning methods. More importantly, the present study incorporated independent external validation and exploratory heatmap analysis of misclassified cases to evaluate model generalizability and potential sources of model error.
It should be noted that although the above literature-based comparison helps position the performance of our model within the broader context of OSCC histopathological image diagnosis, this comparison remains indirect. Previous methods differ in terms of data sources, image magnification, tiling strategies, train-test splitting, preprocessing workflows, evaluation metrics, and the availability of source code and model weights (14). Moreover, some OSCC-specific methods have not released complete code or reproducible experimental configurations. Therefore, these methods could not be rigorously reproduced and directly compared under a completely consistent experimental protocol in the present study. Accordingly, this section should be interpreted as a literature-based contextual benchmark rather than a strict head-to-head comparison using the same cohort, workflow, and evaluation criteria. Future studies should conduct systematic comparisons of OSCC-specific models, conventional CNN models, pathology foundation models, and MIL models using unified public datasets, standardized preprocessing workflows, and fixed validation protocols (15).
To further contextualize the diagnostic performance of the proposed model, we also compared our results with pathologist-level diagnostic performance reported in a previous OSCC histopathology study. The reported performance of junior, senior, and chief pathologists provided a clinically relevant reference for interpreting model performance. In the present study, the UNI-2-based model achieved numerically higher sensitivity, F1-score, and AUC than the reference values reported for pathologists in the previous study. However, this comparison should be interpreted cautiously because the pathologist results were derived from a previously published study rather than from a reader study conducted on the same validation cohort. Therefore, these results should be regarded as a reference-based contextual comparison rather than definitive evidence of superiority over human experts (16).
Interpretability remains an important practical consideration for histopathology AI, but it must be interpreted within the limits of the available annotations. In this study, attention/response heatmaps were generated as an exploratory visualization tool to inspect model focus patterns and support qualitative error review. Because pixel-level or region-level lesion annotations were not available, these heatmaps cannot be used to quantitatively validate lesion localization or to prove spatial correspondence with true OSCC regions. In correctly classified OSCC cases, heatmaps provided a visual overview of regions that contributed more strongly to model predictions, while in misclassified cases they helped identify potential sources of false-positive and false-negative decisions (17). These analyses may facilitate expert review and model debugging, but they should not be interpreted as histological segmentation maps, precise lesion boundaries, or validated localization evidence. Future studies incorporating region-level annotations, pathologist-reviewed regions of interest, or annotation-based metrics such as Dice coefficient and intersection-over-union will be needed to rigorously evaluate the spatial reliability of model attention patterns.
Several methodological aspects merit discussion. First, self-attention-based multiple-instance aggregation is suitable for OSCC histopathology modeling because diagnostic information may be distributed across multiple tissue regions, including epithelial compartments, tumor-like nests, stromal reactions, and invasive fronts. Compared with simple pooling, self-attention can model dependencies among patch-level instances and aggregate diagnostically relevant information at the image level. Second, the high performance observed in cross-validation suggests that the current binary classification task may contain strong visually separable signals. Therefore, more stringent evaluations are needed, including cross-center validation with heterogeneous scanners and staining protocols, as well as assessments on more challenging diagnostic categories such as epithelial dysplasia, carcinoma in situ, inflammatory mimickers, and borderline lesions. Third, although we reported a comprehensive metric panel, calibration and clinical-utility analyses were not included. Reliability diagrams, calibration metrics, decision-curve analysis, and threshold-specific evaluation would be important for translating high AUC values into clinically trustworthy probability outputs (18).
This study has several limitations. First, the dataset was based on image-level supervision and did not include region-level annotations, which restricted quantitative evaluation of heatmap localization accuracy. Second, the current task was limited to binary classification between normal and OSCC, whereas real-world diagnostic workflows often involve a broader spectrum of benign, premalignant, inflammatory, and malignant lesions. Third, color variation and acquisition heterogeneity may still influence model performance. Explicit stain normalization, domain adaptation, or federated multicenter evaluation may further improve generalizability. Finally, the current framework used patch-based image processing rather than a full whole-slide image pipeline in the strict clinical sense. Future work should extend this approach to true WSI-level analysis with multi-resolution sampling, slide-level aggregation, and prospective validation in routine pathology workflows.
Overall, our results suggest that combining pathology foundation model representations with attention-based MIL is an effective strategy for weakly supervised image-level OSCC histopathology diagnosis. The proposed framework achieved strong internal and external validation performance, outperformed a conventional ResNet-50 baseline, and provided exploratory heatmap visualization for qualitative model review and error analysis. These findings support the potential of foundation model-based weakly supervised learning as a reusable technical pathway for OSCC histopathology modeling, while future studies with region-level annotations and prospective multicenter validation are needed to establish its localization reliability and clinical utility.
Conclusions
We propose a weakly supervised deep learning model for OSCC diagnosis and detection in histopathology images that integrates UNI-2 pathology foundation representations with self-attention multiple-instance aggregation. The model achieves consistently high performance in five-fold cross-validation and preserves strong generalization on an independent external validation cohort. Beyond high accuracy and AUC, the model maintains favorable MCC and precision, indicating robust decision quality. Attention-derived heatmaps provide decision-consistent spatial evidence that aligns with visually recognizable OSCC morphological features, supporting interpretability and traceability under weak supervision. These findings highlight the value of pathology foundation models for improving robustness and stability and suggest that the proposed framework can serve as a practical basis for further multi-center evaluation and future extension toward clinically deployable OSCC pathology AI.
Acknowledgments
None.
Footnote
Reporting Checklist: The authors have completed the TRIPOD reporting checklist. Available at https://tcr.amegroups.com/article/view/10.21037/tcr-2026-0470/rc
Peer Review File: Available at https://tcr.amegroups.com/article/view/10.21037/tcr-2026-0470/prf
Funding: None.
Conflicts of Interest: All authors have completed the ICMJE uniform disclosure form (available at https://tcr.amegroups.com/article/view/10.21037/tcr-2026-0470/coif). The authors have no conflicts of interest to declare.
Ethical Statement: The authors are accountable for all aspects of the work in ensuring that questions related to the accuracy or integrity of any part of the work are appropriately investigated and resolved. This study was conducted in accordance with the Declaration of Helsinki and its subsequent amendments.
Open Access Statement: This is an Open Access article distributed in accordance with the Creative Commons Attribution-NonCommercial-NoDerivs 4.0 International License (CC BY-NC-ND 4.0), which permits the non-commercial replication and distribution of the article with the strict proviso that no changes or edits are made and the original work is properly cited (including links to both the formal publication through the relevant DOI and the license). See: https://creativecommons.org/licenses/by-nc-nd/4.0/.
References
- Xue N, Wang Y, Wang Z, et al. Trends in immunotherapy for oral squamous cell carcinoma. Cell Oncol (Dordr) 2025;48:1159-79. [Crossref] [PubMed]
- Lim AM, McDowell L, Hurt C, et al. Assessment of endpoint definitions in curative-intent trials for mucosal head and neck squamous cell carcinomas: Head and Neck Cancer International Group consensus recommendations. Lancet Oncol 2024;25:e318-30. [Crossref] [PubMed]
- Graillon N, Iocca O, Carey RM, et al. What has the National Cancer Database taught us about oral cavity squamous cell carcinoma? Int J Oral Maxillofac Surg 2022;51:10-7. [Crossref] [PubMed]
- Pirayesh Z, Mohammad-Rahimi H, Ghasemi N, et al. Deep Learning-Based Image Classification and Segmentation on Digital Histopathology for Oral Squamous Cell Carcinoma: A Systematic Review and Meta-Analysis. J Oral Pathol Med 2024;53:551-66. [Crossref] [PubMed]
- Yang SY, Li SH, Liu JL, et al. Histopathology-Based Diagnosis of Oral Squamous Cell Carcinoma Using Deep Learning. J Dent Res 2022;101:1321-7. [Crossref] [PubMed]
- Alabi RO, Youssef O, Pirinen M, et al. Machine learning in oral squamous cell carcinoma: Current status, clinical concerns and prospects for future-A systematic review. Artif Intell Med 2021;115:102060. [Crossref] [PubMed]
- Pereira-Prado V, Martins-Silveira F, Sicco E, et al. Artificial Intelligence for Image Analysis in Oral Squamous Cell Carcinoma: A Review. Diagnostics (Basel) 2023;13:2416. [Crossref] [PubMed]
- Lu MY, Williamson DFK, Chen TY, et al. Data-efficient and weakly supervised computational pathology on whole-slide images. Nat Biomed Eng 2021;5:555-70. [Crossref] [PubMed]
- Chen RJ, Ding T, Lu MY, et al. Towards a general-purpose foundation model for computational pathology. Nat Med 2024;30:850-62. [Crossref] [PubMed]
- Ananthakrishnan B, Shaik A, Kumar S, et al. Automated Detection and Classification of Oral Squamous Cell Carcinoma Using Deep Neural Networks. Diagnostics (Basel) 2023;13:918. [Crossref] [PubMed]
- Zafar A, Khalid M, Farrash M, et al. Enhancing Oral Squamous Cell Carcinoma Detection Using Histopathological Images: A Deep Feature Fusion and Improved Haris Hawks Optimization-Based Framework. Bioengineering (Basel) 2024;11:913. [Crossref] [PubMed]
- Mohan R, Rama A, Raja RK, et al. OralNet: Fused Optimal Deep Features Framework for Oral Squamous Cell Carcinoma Detection. Biomolecules 2023;13:1090. [Crossref] [PubMed]
- Wu M, Hu Y, Tian F, et al. EfficientNetSwift: A Lightweight and Precise Deep Learning Model for Detecting Oral Squamous Cell Carcinoma Using Pathological Images. Technol Cancer Res Treat 2025;24:15330338251380966. [Crossref] [PubMed]
- Panigrahi S, Nanda BS, Bhuyan R, et al. Classifying histopathological images of oral squamous cell carcinoma using deep transfer learning. Heliyon 2023;9:e13444. [Crossref] [PubMed]
- Sukegawa S, Ono S, Tanaka F, et al. Effectiveness of deep learning classifiers in histopathological diagnosis of oral squamous cell carcinoma by pathologists. Sci Rep 2023;13:11676. [Crossref] [PubMed]
- Ragab M, Asar TO. Deep transfer learning with improved crayfish optimization algorithm for oral squamous cell carcinoma cancer recognition using histopathological images. Sci Rep 2024;14:25348. [Crossref] [PubMed]
- Wang X, Yang S, Zhang J, et al. Transformer-based unsupervised contrastive learning for histopathological image classification. Med Image Anal 2022;81:102559. [Crossref] [PubMed]
- Ahmad M, Irfan MA, Sadique U, et al. Multi-Method Analysis of Histopathological Image for Early Diagnosis of Oral Squamous Cell Carcinoma Using Deep Learning and Hybrid Techniques. Cancers (Basel) 2023;15:5247. [Crossref] [PubMed]

