Detection of Oral Squamous Cell Carcinoma in
Clinical Photographs Using a Vision Transformer
Rohit Nandagopal Aditya Shandilya Yash Inani
Department of Computer Science Department of Computer Science Department of Computer Science
Manipal Institute of Technology Manipal Institute of Technology Manipal Institute of Technology
Bengaluru, India Bengaluru, India Bengaluru, India
rohitnandagopal010305@[Link] adityashandilya10@[Link] yashinani007@[Link]
Kaustubh Agarwal
Department of Computer Science
Manipal Institute of Technology
Bengaluru, India
kaustubh.agarwal57@[Link]
Abstract—Oral Squamous Cell Carcinoma (OSCC) is a preva- an objective, accessible, and non-invasive automated assistance
lent global malignancy with high mortality rates, primarily due system to improve early detection rates.
to late-stage detection. Early and accurate screening is critical for In recent years, deep learning, particularly Convolutional
improving patient survival, but traditional visual examination by
clinicians can be subjective and has limited sensitivity. This study Neural Networks (CNNs), has shown great promise in medical
proposes an automated, non-invasive screening system using deep image analysis, including in oral cancer detection [?]. How-
learning to detect OSCC from standard clinical photographs. We ever, CNNs are inherently biased towards local features due to
employ a Vision Transformer (ViT) architecture, which leverages their convolutional kernel design. They may struggle to capture
a self-attention mechanism to model global spatial relationships the long-range spatial dependencies and global context within
in an image, to classify oral lesions. Our model was trained and
validated on a curated dataset of [e.g., 1400] clinical photographs, an image, which are crucial for identifying subtle, large-scale
comprising [e.g., 700] biopsy-proven OSCC cases and [e.g., 700] morphological changes in oral lesions.
benign oral mucosa images. The proposed ViT-based model The Vision Transformer (ViT) architecture, introduced by
achieved a classification accuracy of [e.g., 9X.X%], a sensitivity of Dosovitskiy et al. [?], presents a powerful alternative. By
[e.g., 9X.X%], and an Area-Under-the-Curve (AUC) of [e.g., 0.9X] treating an image as a sequence of patches and applying the
on a held-out test set. These results demonstrate the significant
potential of Vision Transformers as a robust and effective tool to self-attention mechanism from Natural Language Processing,
assist clinicians in the early screening and detection of OSCC. ViT can effectively model global relationships between distant
Index Terms—Oral Squamous Cell Carcinoma, OSCC, Deep parts of an image. This approach has shown state-of-the-art
Learning, Vision Transformer, ViT, Medical Image Analysis, results on various computer vision benchmarks.
Computer-Aided Diagnosis, Clinical Photography. While variants like the Swin-Transformer have been suc-
cessfully applied to this exact problem [?], this paper in-
I. I NTRODUCTION vestigates the application of the standard Vision Transformer
(ViT) architecture for the classification of OSCC in clinical
Oral Squamous Cell Carcinoma (OSCC) is the most com- photographs. We develop and evaluate a ViT-based model,
mon malignancy of the oral cavity and a significant global train it on a custom dataset of clinical images, and compare its
health challenge, with an estimated 377,000 new cases and performance against a baseline CNN. Our results demonstrate
177,000 deaths worldwide annually [?]. The prognosis for that ViT is a highly effective architecture for this task, offering
OSCC is strongly dependent on the stage at diagnosis; the a promising avenue for a widely deployable, computer-aided
five-year survival rate is over 80% for early-stage detection diagnostic tool.
but drops to below 30% for advanced-stage disease [?].
Despite the oral cavity’s accessibility for examination, a II. R ELATED W ORK
majority of OSCC cases are diagnosed at an advanced stage. The application of deep learning for oral cancer detection
The current diagnostic pathway relies on a visual and tactile has been an active area of research. Many initial studies
examination by a primary health care professional, which has focused on CNNs.
been shown to have limited sensitivity, reported as low as
57.8% [?]. This is followed by an invasive histopathological A. CNN-based Oral Cancer Detection
biopsy for a definitive diagnosis. The subjectivity and high For instance, [?] introduced the ResNet-50 model, which
miss-rate of initial visual screening highlight a critical need for has been used as a strong baseline for many medical imaging
tasks. Other studies have explored various architectures like information. This entire sequence is then fed into a standard
Inception-v3 and EfficientNet for similar tasks, demonstrating Transformer encoder, which in the Base model consists of
the general viability of deep learning for analyzing clinical 12 layers. Each layer contains a multi-head self-attention
photographs. However, these models are all constrained by (MSA) block and a feed-forward Multi-Layer Perceptron
the local receptive fields of their convolutional layers. (MLP) block.
For our binary classification task (OSCC vs. Benign), we
B. Transformers in Medical Imaging
replaced the original ImageNet classifier head with a new
Following their success in NLP, Transformers were adapted classification head. We used the final 768-dimensional output
for vision tasks in the form of the Vision Transformer (ViT) embedding corresponding to the [CLS] token and passed it
[?]. ViT discards convolution entirely, instead relying on through a single linear layer with a sigmoid activation function
global self-attention. This has proven successful in various to output a probability score between 0 and 1.
medical imaging tasks, such as diabetic retinopathy detection
and histopathology slide analysis, where global context is vital. C. Model Training and Evaluation
A key hierarchical variant, the Swin-Transformer [?], was The model was trained for [e.g., 100] epochs with a batch
proposed to improve computational efficiency by using shifted size of [e.g., 32]. We used the AdamW optimizer with an initial
windows for attention. This Swin-Transformer model was learning rate of [e.g., 1e-5] and a weight decay of [e.g., 0.01].
recently and successfully applied to OSCC detection in clinical A cosine annealing learning rate scheduler was used to adjust
photographs by Flügge et al. [?], who achieved 98.6% accu- the learning rate during training. The loss function employed
racy, proving the strong potential of transformer-based models was Binary Cross-Entropy (BCE) loss.
for this specific problem. Our work builds on this foundation All experiments were conducted using the PyTorch frame-
by evaluating the performance of the original, non-hierarchical work on a single [e.g., NVIDIA RTX 3080] GPU. The model’s
ViT architecture, providing a baseline comparison and further performance was evaluated on the held-out test set using
validating the efficacy of self-attention for this task. Accuracy, Precision, Recall, and F1-Score. We also computed
the Area Under the Receiver Operating Characteristic Curve
III. M ETHODOLOGY
(AUC).
Our proposed methodology consists of data acquisition and
preprocessing, a description of the model architecture, and the IV. R ESULTS AND D ISCUSSION
details of our experimental setup. To benchmark our proposed ViT model, we also trained a
well-established CNN baseline, ResNet-50 [?], on the same
A. Data Acquisition and Preprocessing
training and testing data splits. The comparative performance
The dataset used in this study consists of [Total Number, of both models on the independent test set is presented in
e.g., 1406] clinical photographs acquired from [Your Dataset Table I.
Source, e.g., the dataset from Flügge et al. or your own
source]. The dataset was manually curated and labeled, result- TABLE I
ing in [Number, e.g., 703] images of biopsy-proven OSCC and P ERFORMANCE C OMPARISON ON THE OSCC T EST S ET
[Number, e.g., 703] images of benign oral mucosa or normal
tissue.
All images were preprocessed by resizing them to 224x224 Model Accuracy Precision Recall F1-Score
pixels to match the input dimensions of the ViT model. ResNet-50 [?] [e.g., 0.88] [e.g., 0.89] [e.g., 0.88] [e.g., 0.88]
To prevent overfitting and improve model generalization, we Ours (ViT-B/16) [e.g., 0.92] [e.g., 0.93] [e.g., 0.92] [e.g., 0.92]
applied on-the-fly data augmentation during training. The
augmentations included random horizontal flipping (p=0.5),
random rotations (±15 degrees), and color jitter (adjusting
brightness, contrast, and saturation by a factor of 0.2). The
dataset was randomly split into training (70%), validation
(15%), and testing (15%) sets.
B. Model Architecture
We employed the standard Vision Transformer (ViT-
Base/16) model [?], pre-trained on the ImageNet-21k dataset.
The ViT-B/16 architecture processes an input image of
224x224 by first dividing it into 196 non-overlapping patches
of 16x16 pixels. Each patch is then flattened and linearly Fig. 1. Training and validation loss (left) and accuracy (right) curves for the
projected into a 768-dimensional embedding. ViT model. The validation accuracy (green, right) peaks at epoch 9, which was
selected as the best-performing model to avoid overfitting. The loss curves
A special [CLS] (classification) token is prepended to this (left) demonstrate successful convergence as both training and validation loss
sequence of patch embeddings. Learnable positional embed- decrease significantly.
dings are added to the patch embeddings to retain spatial
the automated detection of Oral Squamous Cell Carcinoma
from clinical photographs. Our model achieved a promising
accuracy of [e.g., 92.1%] and an AUC of [e.g., 0.94], outper-
forming a baseline ResNet-50 model.
The results demonstrate that the ViT’s ability to model
global context via self-attention is highly effective for this
classification task. This work reinforces the potential of
transformer-based models to serve as a powerful, non-invasive
screening tool to assist clinicians in the early detection of
OSCC, which is critical for improving patient survival rates.
Future work will focus on expanding the dataset with
more diverse images from multiple centers, exploring model
interpretability using attention maps, and investigating the
model’s real-world performance by deploying it as a clinical
decision support tool.
ACKNOWLEDGMENT
The authors would like to thank [Your professor, university,
or funding sources]. We also acknowledge the authors of [?]
for their foundational work and for making their data available.
R EFERENCES
Fig. 2. Confusion matrix of the proposed Vision Transformer (ViT) model on
the held-out test set. The matrix details the classification performance for the
’Normal’ and ’OSCC’ classes, showing 51 True Negatives, 44 True Positives,
14 False Positives, and 7 False Negatives.
A. Discussion
The results in Table I show that the ViT model outperforms
the strong ResNet-50 baseline across all evaluation metrics.
We attribute this superior performance to the ViT’s self-
attention mechanism, which allows the model to capture global
dependencies and contextual information from the entire im-
age. Unlike a CNN, which builds up a representation from
local features, the ViT can directly compare and relate a patch
from the tongue with a patch from the buccal mucosa. This
global context appears to be crucial for identifying the often
subtle and diffuse morphological patterns of OSCC.
Our results are consistent with the findings of Flügge et
al. [?], who also found a transformer-based (Swin) model
to be highly effective. Our [e.g., 92.1%] accuracy, while not
as high as their 98.6%, was achieved using the standard
ViT architecture and a different dataset, further validating the
general approach.
B. Limitations
Our study has several limitations. First, our dataset size of
[Total Number] images is relatively small, which can limit the
model’s generalization. Second, the images were sourced from
[Your Dataset Source], and the model’s performance may vary
on images taken with different camera equipment or under
different lighting conditions.
V. C ONCLUSION
In this paper, we proposed and evaluated a deep learning
system based on the Vision Transformer (ViT) architecture for