A self-supervised pre-training method for lesion segmentation in oral potentially malignant disorders Authors: Yuqi Cao, Miao Lu, Jiayuan Zhang, Rui Zhang, Linjun Shi, Hongxia Dan, Pingjie Huang, Guangxin Zhang, Qianming Chen Published: 2026 ABSTRACT AbstractObjectiveSupervised training for oral potentially malignant disorder (OPMD) image segmentation requires expensive annotated data, particularly scarce in remote regions with few medical specialists. This study aims to propose a self-guided pre-training method to automatically extract features from unlabeled images, enhancing the performance of OPMD lesion segmentation.Materials and methodsThis study utilized 3,417 OPMD photographs from ZJUSS as the internal dataset and two independent external datasets from WCHS and CS-SJTU for validation. The internal labeled dataset was evaluated using five independent patient-level train/validation/test splits to prevent patient-level data leakage. We proposed a multiscale separable attention masked image model, MS-SAMIM, and a self-guided mask generation method. To enhance robustness, we incorporated a teacher–student consistency constraint and a contrastive learning constraint.ResultsOur model achieved 84.35% Dice, 74.65% IoU, 81.84% sensitivity, and 88.02% precision in OPMD lesion segmentation, surpassing various advanced fully supervised and other self-supervised approaches. In the external validation, the model achieved 82.15% Dice, 70.09% IoU, 77.96% sensitivity, and 87.84% precision on external dataset #1 and 81.18% Dice, 69.71% IoU, 78.58% sensitivity, and 84.39% precision on external dataset #2.ConclusionsThe proposed self-guided pre-training strategy may reduce reliance on pixel-level annotations and improve OPMD lesion segmentation from clinical photographs. Further prospective validation is required before clinical deployment.Supplementary InformationThe online version contains supplementary material available at 10.1186/s12903-026-08862-x.Keywords: Self-supervised learning, Masked image modeling, Oral potentially malignant disorder, Semantic segmentation Background During the past decade, the prevalence of oral diseases has increased significantly, particularly among younger populations, due to significant lifestyle shifts, such as unhealthy diets, increased alcohol consumption, stress, and sleep deprivation. The Global Oral Health Status Report 2022 indicates that oral diseases affect approximately 3.5 billion individuals globally, placing increasing pressure on healthcare systems and highlighting the urgent need for effective early diagnosis [1]. Among these conditions, oral potentially malignant disorders (OPMDs) are clinically important because they can progress to oral squamous cell carcinoma (OSCC) if they are not detected and treated early [2, 3]. OPMDs often present with subtle, variable lesion features, making them difficult to detect and assess accurately. Traditional diagnostic methods rely mainly on professional physicians for detailed observation through visual inspection and palpation, whereas more precise diagnoses require histopathological examination. This approach is costly in time and labor, and it is also affected by physicians’ subjectivity and personal factors such as fatigue, emotions, and insufficient experience, which is a significant challenge in primary care settings where access to experienced specialists is limited. As a result, automated and reliable diagnostic tools are urgently needed to support clinical decision-making. Over the past few years, the rapid advancement of artificial intelligence, especially the wide adoption of deep learning methods in medical images and signal analysis, has brought new hope for addressing the challenges mentioned above [4]. These approaches have risen to prominence as mainstream solutions for automated medical image analysis, as they can automatically extract features from medical images and accomplish end-to-end tasks, including those related to oral images [5–6]. Researchers have conducted extensive studies on various oral diseases, including OPMDs and oral cancer [7–9]. For example, Keser et al. proposed an InceptionV3-based deep learning framework to detect oral lichen planus lesions from clinical photographs [10]. Lin et al. introduced a smartphone-implemented, HRNet-based deep learning framework that automatically detects oral cancer and OPMDs [11]. More recently, clinical-photograph–based oral lesion analysis has increasingly moved from image-level classification toward lesion detection and segmentation. Vinayahalingam et al. used a Mask R-CNN with a Swin Transformer for multi-class detection of OPMDs and OSCC from annotated clinical photographs [12]. Ouyang et al. proposed AAFNet for OPMD image segmentation, emphasizing adjacent feature fusion and attention mechanisms to address subtle tissue differences and lesion variability [13]. Al-Ali et al. developed CLASEG, a classification-based segmentation framework for differential diagnosis across multiple oral lesion categories [14]. These studies demonstrate the growing importance of photograph-based oral lesion segmentation and diagnosis. Clinical challenges in oral-photograph lesion segmentation However, oral clinical photographs present several challenges for automated lesion segmentation. Unlike standardized radiological imaging, intraoral photographs are often affected by heterogeneous illumination, shadows, specular highlights from saliva or mucosa, motion blur, and variations in camera type, shooting angle, and distance. In addition, auxiliary objects such as mouth mirrors, retractors, gauze, and dental instruments may appear in the image and introduce high-contrast structures unrelated to the lesion. OPMD lesions also show considerable variability in color, shape, size, boundary sharpness, and anatomical location. These factors make pixelwise lesion delineation difficult and contribute to domain shift across different clinical centers. MIM/MAE-style self-supervised learning for dense prediction To overcome the common limitation of insufficient annotations and fully leverage unlabeled data, self-supervised learning provides a way to exploit unlabeled images and reduce dependence on costly pixelwise annotations [15–17]. Dense self-supervised learning methods for medical image segmentation have further shown that pixel-level representations can be learned directly from unlabeled images, thereby reducing the manual annotation burden for segmentation tasks [18]. Among existing self-supervised strategies, masked image modeling (MIM) and masked autoencoder (MAE)-style pre-training have shown strong potential because they force the model to reconstruct missing image regions and learn transferable visual representations. Zhou et al. demonstrated that employing masked autoencoders (MAEs) in a self-supervised pre-training paradigm can enhance vision transformer performance in medical imaging [19]. Xu et al. introduced an adaptive masking strategy driven by reinforcement learning designed to improve self-supervised medical image segmentation under limited annotation conditions [20]. However, self-supervised methods that leverage unlabeled data, such as masked image modeling (MIM), especially those based on vision transformers (ViTs), often struggle to capture multiscale features because of limited downsampling. This restriction has an adverse impact on dense prediction tasks, particularly the semantic segmentation employed in medical imaging [21]. Moreover, the traditional self-supervised pre-training process overlooks the effective information of both the model and the data during training, resulting in slow convergence and limited feature extraction capability. In particular, ViT-based models typically lack inductive biases in convolutional neural networks (CNNs), making them heavily reliant on large-scale pre-training data for generalization, further worsening the problem in low-resource domains such as OPMDs [22]. Non-random masking and motivation of the proposed method Recent studies have explored non-random masking strategies, including reconstruction-guided masking, anatomy- or region-aware masking, and reinforcement-driven adaptive masking. These methods suggest that masking informative or difficult regions can improve representation learning. Nevertheless, directly selecting high-loss regions may be unstable in clinical oral photographs because artifacts such as specular highlights or instrument reflections can also generate high reconstruction errors. To address this issue, we propose self-guided MS-SAMIM. The method uses an EMA teacher to generate a reconstruction-loss map, gradually increases the loss-guided masking ratio through a curriculum schedule, and preserves stochasticity by mixing loss-guided masking with random adjacent masking. In addition, a consistency constraint and a contrastive learning constraint are incorporated to stabilize the learned representations. Architecturally, MS-SAMIM combines separable convolution in early stages to introduce local inductive bias with self-attention in later stages to capture global context, and further fuses multiscale features. This design specifically targets the limited annotation, multiscale lesion morphology, artifact interference, and cross-center domain shift encountered in OPMD lesion segmentation. The main contributions of this study are as follows. First, we develop MS-SAMIM, a self-supervised MIM architecture that combines separable convolution, self-attention, and multiscale feature fusion for oral lesion segmentation. Second, we introduce a self-guided masking strategy in which an EMA teacher generates loss-guided masks through a progressive curriculum while random masking is retained to prevent overfitting to artifacts. Third, we incorporate teacher–student consistency and contrastive constraints to improve feature robustness. Fourth, we validate the proposed method on an internal dataset and two external datasets, and further analyze annotation efficiency, statistical significance, preprocessing, annotation procedure, and reproducibility. Methods Data acquisition and annotation This study employed an internal dataset for model pre-training and fine-tuning and utilized two external datasets to validate the model’s generalizability. As shown in Table 1, the internal dataset (ZJUSS) utilized in this study was obtained from patients with oral mucosal diseases at the Stomatology Hospital, Zhejiang University School of Medicine. Patients ranged in age from 19 to 75 years. Each case included detailed intraoral white-light photos taken before and after treatment, along with pathology reports confirming diagnoses of oral leukoplakia (OLK), oral lichen planus (OLP), and oral submucous fibrosis (OSF). Images with incorrect shooting positions, poor focus, or improper exposure were excluded. A total of 2,579 unannotated OPMD images were utilized for masked image modeling self-supervised pre-training, whereas 838 pixelwise annotated images from 341 patients were used for semantic segmentation training, comprising 523 OLP, 201 OLK, and 114 OSF images. Table 1Clinical and demographic characteristics of study datasetsCenterAge (y)Number of patientsUnlabeledLabeledAvailableMaleFemaleOLPOLKOSFZJUSS48.5(19–75)168(0.49)173(0.51)25795232011143417WCHS53.5(22–83)113(0.49)119(0.51)/202131155488CS-SJTU50.8(26–76)110(0.52)102(0.48)/27447555804 Clinical and demographic characteristics of study datasets The external validation dataset #1 (WCHS) was sourced from Huaxi Stomatological Hospital, Sichuan Province, and included patients aged 22–83 years. External dataset #2 (CS-SJTU) was collected from Shanghai Ninth People’s Hospital and covers patients aged 26–76 years. These two external datasets were utilized to evaluate the generalizability of our method. Detailed information regarding the datasets is listed in Table 1. Figure 1 presents sample images of the three OPMD categories collected from three clinical centers. Samples of three typical types of OPMDs from three centers The segmentation task was defined as a four-class semantic segmentation problem, including background, OLP, OLK, and OSF. For each image, lesion regions were annotated as the corresponding OPMD category, while all non-lesion pixels were treated as background. During evaluation, Dice, IoU, sensitivity, and precision were calculated for each foreground category and then macro-averaged across OLP, OLK, and OSF. All participating centers followed the same annotation guideline document. Before formal annotation, annotators participated in a calibration session using representative images to standardize lesion boundary delineation, handling of ambiguous margins, and exclusion of non-lesion structures such as saliva reflections, teeth, mirrors, gauze, and retractors. Each image was independently annotated by at least two experienced oral specialists using LabelMe. If disagreement occurred, a senior oral specialist/pathologist reviewed the case in a blinded manner, and the final mask was determined by consensus. Image preprocessing and augmentation All clinical photographs were first converted to RGB format and visually screened. Images with incorrect shooting position, poor focus, or improper exposure were excluded before model development. No lesion-centered manual cropping or automatic mouth-region detection was applied, because such preprocessing may introduce lesion-location priors and may not be robust across centers. Non-lesion structures such as teeth, lips, mouth mirrors, gauze, and retractors were retained in the images to reflect real-world clinical acquisition conditions. For model input, images were resized to 224 × 224 pixels using direct bilinear interpolation. Pixel intensities were scaled to [0, 1] and normalized using the mean and standard deviation computed from the internal training set. No histogram equalization, color constancy correction, or automatic specular-highlight removal was applied, because these operations may alter clinically relevant mucosal color and texture. During pre-training, the main experiments used a minimal augmentation strategy consisting of random horizontal flipping. During segmentation fine-tuning, random flipping and random rotation were applied. To evaluate whether minimal augmentation limited external generalization, we additionally conducted an augmentation ablation experiment using clinically safe acquisition-variation augmentations, including mild brightness/contrast jitter, gamma adjustment, slight Gaussian blur, and JPEG compression. These augmentations were selected to simulate variations in illumination, focus, and image compression without changing lesion morphology or boundary annotation. The detailed augmentation parameters and results are summarized in Table S2 and Table S3. The proposed method The structure of our proposed method is illustrated in Fig. 2. We developed a MIM model, MS-SAMIM, combining separable convolutions and self-attention mechanism with multiscale feature fusion. We introduce a self-guided mask generation method that leverages a mean teacher‒student paradigm. In this framework, the teacher model produces loss-guided masks, the student model first undergoes reconstruction training, and its pre-trained encoder is then leveraged as the backbone for a semantic segmentation model designed for the OPMD lesion segmentation task. We first evaluated the semantic segmentation model via our internal labeled dataset and then assessed its generalizability to two independent external datasets. Overall workflow of the proposed self-guided MS-SAMIM framework. Unlabeled OPMD photographs are first used for self-supervised MIM pre-training. An EMA teacher generates reconstruction-loss maps from randomly masked inputs, and these loss maps are combined with random adjacent masks to guide student reconstruction. After pre-training, the student encoder is transferred to a downstream semantic segmentation model for OPMD lesion segmentation and evaluated on internal and external datasets MS-SAMIM Unlike many MIM approaches that employ backbones such as ViT or Swin as basic structures for both the encoder and decoder, MS-SAMIM first extracts features via a combination of separable convolution (SepConv) and a self-attention mechanism, subsequently fusing these representations across multiple scales. The specific architecture of MS-SAMIM is shown in Fig. 3a. To preserve rich image features, an adjacent masking strategy is adopted, as shown in Fig. 3c: for each randomly selected patch, its three adjacent patches forming a 2 × 2 grid (with the selected patch at the top-left as the starting index) are masked together. This effectively quadruples the masked area, increasing reconstruction difficulty, thereby compelling the model to acquire more robust feature representations. Architecture of MS-SAMIM and adjacent random masking strategy. a MS-SAMIM adopts a four-stage hierarchical encoder. The early stages use separable convolution to introduce local inductive bias, whereas the later stages use self-attention to capture global context. Multiscale features are aligned and fused for reconstruction-oriented representation learning. b Internal block structure, where the token mixer is implemented as either separable convolution or self-attention, followed by SwiGLU-based feed-forward transformation. c Adjacent random masking. A starting patch is randomly selected, and its neighboring 2 × 2 patch block is masked together to increase reconstruction difficulty and encourage local structural learning The feature sequence undergoes downsampling before each stage, with the four stages processing feature blocks and ultimately outputting features at different dimensions, providing rich multiscale features. Within each stage, the token mixer facilitates interpatch feature fusion and serves as the model’s core learning module. The first two stages employ separable convolution to introduce local inductive bias and reduce computational complexity, enhancing local feature learning and accelerating convergence on small datasets. The latter two stages use self-attention to provide global context aggregation on the basis of earlier local features. Additionally, the SwiGLU activation function replaces the standard FFN in each block to further improve model capacity, as shown in Fig. 3b. The decoder follows the lightweight design principle of the MAE, maintaining overall symmetry with the downsampling structure of the encoder. It consists of four upsampling steps and three stages, with each stage incorporating a limited number of stacked self-attention blocks for decoding. Upon generating the final prediction, the reconstruction loss is applied only to the masked patches by comparing their predicted content to the ground truth from the original image: where M, x and represent the randomly generated mask, the input, and the MIM model composed of the encoder and decoder, respectively. Self-guided mask generation. Given that lesion regions often require more attention, increasing the probability and completeness of masking in these areas can enhance feature learning and improve the robustness of representations. To this end, a self-guided learning method based on loss-guided mask generation is proposed, leveraging a mean teacher‒student framework. The student model performs standard masked reconstruction, and the teacher model, with an identical architecture, generates masks guided by the reconstruction loss calculated itself. The overall mechanism of the self-guided MS-SAMIM is shown in Fig. 4. Mean teacher–student self-guided masking framework. The teacher model receives randomly masked images and generates a reconstruction-loss map. High-loss blocks are selected according to a progressive curriculum and mixed with random adjacent masks. The resulting self-guided mask is applied to the student model for reconstruction training. The student is optimized using reconstruction, consistency, and contrastive losses, while the teacher is updated by EMA without gradient propagation With a total masking ratio of 0.6, the teacher model receives randomly masked inputs at each epoch. To prevent early-training instability, where the teacher loss map may be noisy and may bias masks toward imaging artifacts such as specular highlights rather than lesion regions, we use a progressive curriculum for the loss-guided masking proportion. From epoch 1 to epoch 800, the loss-guided proportion is linearly increased from 0% to 50%; from epoch 800 onward, the ratio is maintained at 50%. The teacher model parameters are updated at the end of each training step using the exponential moving average (EMA) of the student model parameters : where the momentum coefficient follows a cosine schedule from 0.9 to 0.999 during pre-training. No gradients are propagated through the teacher model. The teacher serves only as an inference module for generating loss maps and providing consistency targets, while only the student model receives gradient updates. The loss map is computed as follows. First, the teacher model receives a randomly masked input and produces a full-resolution reconstruction. Second, a per-pixel mean squared error is computed between the reconstructed image and the original image across all three RGB channels. Third, the per-pixel error map is spatially averaged over non-overlapping 2 × 2 patch blocks, matching the granularity of adjacent masking. Fourth, these block-level loss values are ranked in descending order. According to the current curriculum ratio, the top-ranked blocks are selected as loss-guided masks, while the remaining mask quota is filled by random adjacent masking as Fig. 5. This mixed strategy preserves stochasticity and prevents the model from focusing exclusively on consistently hard but potentially uninformative regions. Generation of the self-guided mask. The teacher reconstruction error is first computed at the pixel level and then averaged within non-overlapping 2 × 2 patch blocks. Blocks with higher aggregated reconstruction loss are selected as loss-guided masks according to the curriculum ratio. These blocks are combined with randomly selected adjacent masks to form the final self-guided mask used for student training Additional constraints Since MIM directly reconstructs RGB pixel values and OPMD photographs exhibit a strong red-channel dominance (normalized average: [0.7717, 0.4983, 0.4611]), the model may learn a shortcut by relying excessively on the dominant R-channel statistics, especially under a high masking ratio. This may lead to channel-skewed reconstruction and reduce downstream segmentation robustness. Because OPMD photographs show channel imbalance, we considered the risk that pixel reconstruction may rely on channel-dominant shortcuts. Therefore, we evaluated the effect of the additional constraints using downstream segmentation performance rather than claiming a direct causal correction of color bias. Specifically, the feature maps from the final encoder stage of the teacher and student models are used for consistency learning. Each feature map has shape B×C×H×W at 1/32 input resolution and is spatially flattened into a vector of shape B×(C⋅H⋅W). The consistency loss is computed using cosine similarity between the flattened teacher and student representations. At this resolution, each token encodes a large receptive field and provides coarse spatial-semantic information. Therefore, the consistency loss serves as a high-level semantic alignment signal, complementing the pixel-level reconstruction loss: where and represent the flattened feature vector outputs from the teacher and student model encoders, respectively. Additionally, we incorporate a contrastive learning constraint into the training process, further augmenting the encoder’s ability to extract discriminative features. Specifically, we adopt the InfoNCE loss, which, for a batch of N images, is averaged over all 2 N anchors and defined as follows: For contrastive learning, no additional projection head is applied. For a mini-batch of N images, each image is passed through the student encoder twice with two independently sampled self-guided masks. This produces 2 N final-stage feature maps, which are globally average pooled into 512-dimensional representations. For each anchor representation, the representation from the other masked view of the same image is treated as the positive sample, while the remaining 2 N − 2 representations are treated as negative samples. The diagonal self-similarity terms are excluded. The teacher model is not used in the contrastive loss. The final optimization objective is as follows: where and represent the weights for the consistency constraint and contrastive learning constraint, respectively. Semantic segmentation model UPerNet is a widely adopted semantic segmentation model that can integrate various feature extraction backbones and fuse multiscale features [23]. FreqFusion is an advanced feature upsampling fusion method, which employs a frequency-aware approach to enhance semantic segmentation performance [24]. To evaluate the features obtained from our self-supervised pre-training method, we constructed a downstream semantic segmentation model. This model integrates our pre-trained MS-SAMIM encoder with a UPerNet decoder, employing FreqFusion for feature upsampling and fusion, as shown in Fig. 6. Semantic segmentation network combining MS-SAMIM and UPerNet The pseudocode of the entire method is shown in Algorithm S1 in the supplementary material. Model training Model configuration The base configuration of MS-SAMIM has an input resolution of 224 × 224 and an initial patch size of 4 × 4. The encoder comprises four stages with block numbers [3, 3, 9, 3] and feature dimensions [64, 128, 320, 512], whereas the decoder includes three stages with [2, 2, 2] blocks and a fixed feature dimension of 512. In the mean teacher‒student self-guided mask generation framework, the total masking ratio is set to 0.6. The proportion of loss-guided masking follows a linear warm-up schedule: linearly increasing from 0% to 50% from epoch 1 to 800, and held at 50% thereafter. Pre-training and fine-tuning settings For semantic segmentation fine-tuning, the internal labeled dataset was partitioned into training, validation, and test subsets at a 6:2:2 ratio strictly at the patient level. All images from the same patient, including pre- and post-treatment photographs, were assigned to only one subset. This prevented patient-level data leakage between training, validation, and test sets. The resulting split contained approximately 204 patients for training, 68 for validation, and 69 for testing. Each of the five independent trials used a different random patient-level split with a different random seed; therefore, the reported mean ± standard deviation reflects variability from both patient composition and model initialization. Because different patients contributed different numbers of images, the image counts varied slightly across trials. The two external datasets were used entirely as held-out external validation sets and had no patient or institutional overlap with the internal dataset. Training was performed on an Intel Core i7-13700KF and GeForce RTX 4090 using PyTorch 1.13.1 with CUDA 11.7. During pre-training, the main experiments used random horizontal flipping as the minimal augmentation strategy. Pre-training lasted 1600 epochs (batch size 16) via AdamW with cosine LR (1e-4), weight decay 0.05, and 10-epoch warmup. During segmentation fine-tuning, the main experiments used random flipping and rotation. Fine-tuning lasted 600 epochs (batch size 16) via AdamW with cosine LR (1e-4), weight decay 0.01, and 10-epoch warmup. The temperature τ was fixed to 0.5, and the loss weights for reconstruction, consistency, and contrastive learning were [1, 0.01, 0.1], respectively. The checkpoint with the best validation Dice was selected for testing/external validation. Pre-training was conducted on the internal unlabeled dataset, and an ablation study was conducted on the internal labeled semantic segmentation dataset. Each reported metric represents the mean ± standard deviation, which was calculated across five independent trials. Comparison protocol To ensure a fair comparison, all models were evaluated using the same patient-level data splits, input resolution, preprocessing pipeline, fine-tuning augmentation, optimizer, learning-rate schedule, batch size, number of epochs, and evaluation metrics unless otherwise specified. All reported results were averaged over five independent patient-level trials. The fully supervised baselines, including UNet, SwinUNet, SegNeXt, SegFormer, and Mask2Former, were trained using their standard segmentation architectures, because these models are commonly evaluated as complete segmentation systems. For self-supervised baselines, including MoCov3, SimCLRv2, MAE, SimMIM, and Swin-MAE, the corresponding encoders were first pre-trained on the internal unlabeled OPMD dataset and then fine-tuned for the downstream segmentation task under matched settings. The same UPerNet + FreqFusion decoder was used when the encoder architecture was compatible; otherwise, the closest standard downstream head was used. Parameter counts and FLOPs are reported in Table S4. The most controlled comparison for evaluating the proposed pre-training strategy is provided by MS-SAMIM without pre-training, MS-SAMIM with random-mask pre-training, and self-guided MS-SAMIM, which share the same downstream segmentation architecture. Statistical analysis The metrics of the semantic segmentation model utilized are as follows: the Dice coefficient (Dice), intersection over union (IoU), sensitivity, and precision. The final experimental results are reported as the average of the metrics across all categories. The specific calculation formulas are as follows: For statistical comparison, Dice and IoU were compared across the five matched patient-level trials using two-sided paired t-test. Results Ablation study Effectiveness of the token mixer and feature fusion To evaluate the effectiveness of the token mixers and multiscale feature fusion in MS-SAMIM, we conducted ablation experiments, as shown in Table 2. Using only separable convolution or self-attention across all four encoder stages yielded suboptimal results. In contrast, combining both methods (without feature fusion) improved the performance to 82.73% Dice, 72.32% IoU, 80.20% sensitivity, and 86.61% precision. Convolution introduces inductive bias, enabling better local feature extraction and faster convergence on small datasets such as OPMD images. Self-attention in later stages complements this by capturing global dependencies. Table 2Ablation study on the token mixer and multiscale feature fusion in MS-SAMIMMethodToken mixerFusionDiceIoUSensitivityPrecisionI4×SepConv🗴81.71 ± 1.3071.51 ± 1.5578.94 ± 1.3686.07 ± 1.10II4×Attention🗴82.39 ± 0.7572.19 ± 0.5479.78 ± 1.2386.33 ± 1.49III2×SepConv + 2×Attention🗴82.73 ± 1.1372.32 ± 1.1680.20 ± 0.9786.61 ± 1.27IV2×SepConv + 2×Attention✓83.47 ± 1.1573.53 ± 1.3980.90 ± 1.0887.32 ± 0.97 Ablation study on the token mixer and multiscale feature fusion in MS-SAMIM The incorporation of multiscale feature fusion further increases the performance to 83.47% Dice, 73.53% IoU, 80.90% sensitivity, and 87.32% precision—improvements of 0.74%, 1.21%, 0.70%, and 0.71%, respectively. The integration of convolution and attention mechanisms with multiscale feature fusion within the MS-SAMIM framework proves to be an effective strategy, as validated by our experimental findings. As visually demonstrated in Fig. 7, Method IV achieves the most accurate OPMD segmentation, exhibiting the clearest alignment with the ground truth among the four evaluated approaches. Visualization of the lesion segmentation results of the four methods Effectiveness of the self-guided mask and additional constraints We evaluated the following components of the self-guided MS-SAMIM model: reconstruction (MS-SAMIM baseline), self-guide (adding self-guided masking), consistency (adding the teacher‒student consistency constraint), and contrastive (adding the contrastive learning constraint). As shown in Table 3, the reconstruction baseline achieves 83.47% Dice, 73.53% IoU, 80.90% sensitivity, and 87.32% precision. Introducing self-guided masking improves the results by 0.48%, 0.62%, 0.49%, and 0.42%, respectively. Adding the consistency constraint further enhances the performance, and combining both the consistency constraint and contrastive loss achieves the best results: 84.35% Dice, 74.65% IoU, 81.84% sensitivity, and 88.02% precision—outperforming the baseline by 0.88%, 1.12%, 0.94%, and 0.70%, respectively. Table 3Ablation study on self-guided masks and additional constraintsReconstructionSelf-guideConsistencyContrastiveDiceIoUSensitivityPrecision✓83.47 ± 1.1573.53 ± 1.3980.90 ± 1.0887.32 ± 0.97✓✓83.95 ± 0.7174.15 ± 0.7481.39 ± 1.4387.74 ± 1.22✓✓✓84.09 ± 2.1674.33 ± 1.5981.53 ± 1.7487.88 ± 1.17✓✓✓83.81 ± 1.5573.91 ± 1.1681.33 ± 1.6287.46 ± 1.20✓✓✓✓84.35 ± 1.1974.65 ± 1.0281.84 ± 1.4588.02 ± 0.54 Ablation study on self-guided masks and additional constraints The improved reconstruction quality with consistency constraints is illustrated in Fig. 8. These constraints align teacher and student outputs, promoting robust feature learning and reducing instability-related drift, which may reduce representation instability associated with channel-skewed reconstruction. Comparison of the reconstruction results with and without the consistency constraint Loss weights and masking ratio analysis We examined the effects of different loss weight configurations for , , and , as shown in Table 4. The best performance (84.35% Dice, 74.65% IoU, 81.84% sensitivity, and 88.02% precision) was achieved with weights of [1, 0.01, 0.1]. Table 4Loss weights and masking ratio analysis: loss weights DiceIoUSensitivityPrecision10.10.183.77 ± 1.7273.97 ± 1.6581.27 ± 1.3687.35 ± 1.2210.010.0183.98 ± 1.1274.25 ± 1.1581.47 ± 1.1487.57 ± 1.1010.10.0183.82 ± 1.5474.07 ± 1.3581.31 ± 1.2287.42 ± 1.3310.010.184.35 ± 1.1974.65 ± 1.0281.84 ± 1.4588.02 ± 0.54 Loss weights and masking ratio analysis: loss weights A small weight on consistency loss stabilizes the teacher encoder without overly constraining the student’s updates. Moreover, a larger weight on contrastive loss directly constrains the encoder of the student model, promoting similar feature representations for different masked versions of the same input, thereby enhancing the robustness of feature extraction. As shown in Fig. 9, self-guided masking has clear advantages over random adjacent masking. The optimal masking ratio for the self-guided mask is 0.6, achieving a Dice of 84.35%. Trend analysis shows that self-guided masking performs poorly at low masking ratios but excels at higher ones. This suggests that focusing on hard-to-reconstruct regions helps the model maintain effective learning at higher masking levels, enhancing the encoder’s feature extraction ability. Performance variation with different masking ratios (Dice) Comparative analysis The comparison methods were selected to cover representative categories of segmentation and self-supervised learning approaches. UNet with ResNet152 was used as a classical CNN-based segmentation baseline. SwinUNet, SegNeXt, SegFormer, and Mask2Former were selected because they represent widely used transformer or hybrid segmentation architectures for dense prediction. MoCov3 and SimCLRv2 were included as representative contrastive self-supervised methods, whereas MAE, SimMIM, and Swin-MAE were included as representative masked image modeling methods. Therefore, the comparison evaluates not only complete segmentation systems but also the contribution of different pre-training paradigms under matched downstream settings. For the supervised models, we applied transfer learning by fine-tuning them on the internal OPMD semantic segmentation dataset. For self-supervised methods, we first pre-trained the models on the internal unlabeled OPMD dataset and then fine-tuned them on the internal OPMD semantic segmentation dataset. All methods are validated on two external datasets. The results are provided in Tables 5 and 6, and Table 7 and illustrated in Fig. S2, Fig. S3 and Fig. S4 in the supplementary material. Table 5Semantic segmentation results compared with various methods on the internal datasetMethodsDiceIoUSensitivityPrecisionSupervisedUNet(ResNet152)81.36 ± 1.2470.85 ± 1.9278.52 ± 1.5386.19 ± 1.25SwinUNet(Swin-B)83.03 ± 1.1472.83 ± 1.2580.30 ± 1.1887.41 ± 0.82SegNeXt(Swin-B)82.75 ± 3.4672.46 ± 2.9880.22 ± 2.7586.52 ± 1.73SegFormer(B2)82.49 ± 1.2272.24 ± 1.1979.75 ± 0.8386.86 ± 0.62Mask2Former(Swin-B)83.50 ± 1.1773.25 ± 1.1281.01 ± 1.3187.22 ± 0.79Self-supervisedMoCov3(ViT-B)79.80 ± 2.1469.06 ± 3.1876.91 ± 2.3584.85 ± 1.57SimCLRv2(ResNet152)81.04 ± 1.1070.48 ± 1.2278.19 ± 1.2685.88 ± 0.98MAE(ViT-B)81.95 ± 1.6771.48 ± 1.3779.20 ± 1.0286.46 ± 0.63SimMIM(Swin-B)82.18 ± 1.3571.85 ± 0.9879.40 ± 1.4486.68 ± 0.76Swin-MAE(Swin-B)82.80 ± 1.2772.54 ± 1.3580.25 ± 1.2486.58 ± 1.22OursMS-SAMIM (No pre-train)82.51 ± 3.1272.06 ± 2.7579.97 ± 2.9686.33 ± 1.42MS-SAMIM83.47 ± 1.1573.53 ± 1.3980.90 ± 1.0887.32 ± 0.97Self-guided MS-SAMIM84.35 ± 1.1974.65 ± 1.0281.84 ± 1.4588.02 ± 0.54 Semantic segmentation results compared with various methods on the internal dataset Table 6Semantic segmentation results compared with various methods on external dataset #1 (WCHS)MethodsDiceIoUSensitivityPrecisionSupervisedUNet(ResNet152)78.21 ± 2.5664.79 ± 2.7673.77 ± 2.8784.44 ± 1.69SwinUNet(Swin-B)79.98 ± 1.3467.56 ± 1.4375.36 ± 1.3686.43 ± 1.21SegNeXt(Swin-B)79.30 ± 3.5766.10 ± 3.4875.14 ± 2.9385.40 ± 2.07SegFormer(B2)79.67 ± 1.9866.56 ± 1.6375.56 ± 1.5585.70 ± 0.90Mask2Former(Swin-B)80.09 ± 1.5267.19 ± 1.6476.00 ± 1.2185.99 ± 1.01Self-supervisedMoCov3(ViT-B)78.18 ± 2.1564.68 ± 2.4173.94 ± 2.9684.26 ± 1.84SimCLRv2(ResNet152)79.09 ± 1.7665.84 ± 2.0174.97 ± 1.5584.99 ± 1.59MAE(ViT-B)79.54 ± 1.2266.46 ± 1.3575.30 ± 1.0485.62 ± 0.77SimMIM(Swin-B)80.02 ± 1.2767.10 ± 1.5275.99 ± 0.9585.82 ± 0.64Swin-MAE(Swin-B)80.25 ± 2.4067.93 ± 2.1975.69 ± 1.6386.55 ± 1.09OursMS-SAMIM(No pre-train)78.63 ± 2.5865.49 ± 2.6574.13 ± 2.7684.93 ± 2.02MS-SAMIM80.85 ± 1.4268.46 ± 1.3076.49 ± 1.5286.82 ± 1.51Self-guided MS-SAMIM82.15 ± 1.3470.09 ± 1.3277.96 ± 1.2387.84 ± 0.95 Semantic segmentation results compared with various methods on external dataset #1 (WCHS) Table 7Semantic segmentation results compared with various methods on external dataset #2 (CS-SJTU)MethodsDiceIoUSensitivityPrecisionSupervisedUNet(ResNet152)76.83 ± 1.9664.31 ± 1.8173.71 ± 1.3181.11 ± 1.44SwinUNet(Swin-B)78.72 ± 1.4166.53 ± 0.8475.70 ± 0.8982.71 ± 1.17SegNeXt(Swin-B)78.05 ± 2.0765.73 ± 1.8775.02 ± 1.1682.06 ± 1.29SegFormer(B2)78.25 ± 1.6965.98 ± 0.7675.30 ± 1.0282.11 ± 1.89Mask2Former(Swin-B)80.27 ± 1.8867.94 ± 1.3777.34 ± 0.9283.17 ± 1.72Self-supervisedMoCov3(ViT-B)76.91 ± 1.7764.52 ± 1.5475.04 ± 1.3879.02 ± 1.85SimCLRv2(ResNet152)77.88 ± 1.2865.53 ± 0.9074.87 ± 1.8581.89 ± 1.22MAE(ViT-B)78.70 ± 0.8266.61 ± 1.3876.20 ± 0.9081.73 ± 0.86SimMIM(Swin-B)79.86 ± 1.3168.02 ± 1.3377.38 ± 1.8482.83 ± 1.21Swin-MAE(Swin-B)80.28 ± 1.5968.56 ± 1.6977.76 ± 1.1383.33 ± 1.84OursMS-SAMIM(No pre-train)77.27 ± 1.8464.83 ± 1.9874.17 ± 1.5581.51 ± 1.79MS-SAMIM80.44 ± 1.5668.73 ± 1.8077.70 ± 1.7283.89 ± 1.56Self-guided MS-SAMIM81.18 ± 1.3369.71 ± 1.4778.58 ± 0.9884.39 ± 1.20 Semantic segmentation results compared with various methods on external dataset #2 (CS-SJTU) MS-SAMIM (No pre-train) As shown in Table 5, the proposed self-guided MS-SAMIM model—integrating separable convolution and attention—achieves 84.35% Dice, 74.65% IoU, 81.84% sensitivity, and 88.02% precision, outperforming all the other models across the four metrics. Compared with Mask2Former, the best-performing supervised model with a Swin-Base backbone, our model achieves gains of 0.85% Dice, 1.40% IoU, 0.83% sensitivity and 0.80% precision. Compared with the top self-supervised model, the Swin-MAE, our approach improves by 1.55% in Dice, 2.11% in IoU, 1.59% in sensitivity, and 1.44% in precision. We evaluated the models trained on the internal dataset using two independent external datasets collected from different centers. As shown in Tables 6 and 7, self-guided MS-SAMIM achieved 82.15% Dice, 70.09% IoU, 77.96% sensitivity, and 87.84% precision on the external dataset #1 (WCHS) and 81.18% Dice, 69.71% IoU, 78.58% sensitivity, and 84.39% precision on the external dataset #2 (CS-SJTU), outperforming other fully supervised semantic segmentation models as well as self-supervised approaches. These results suggest that the proposed method generalizes better across external datasets under the current experimental setting. Notably, the self-supervised pre-training methods demonstrated better robustness on the external datasets, exhibiting a smaller drop in performance than their fully supervised counterparts did, with average metric decreases of 2.53% in Dice, 4.62% in IoU, 3.18% in sensitivity, and 2.37% in precision. In contrast, the fully supervised methods showed average decreases of 3.69% in Dice, 6.06% in IoU, 4.67% in sensitivity, and 2.93% in precision. These results demonstrate that the representations learned through self-supervised training exhibit stronger generalization capabilities and hold greater potential in the context of oral image analysis under limited data scenarios. Figures 10 and 11, and Fig. 12 present the segmentation outcomes, contrasting our method with various approaches across internal and external datasets involving OLP, OLK, and OSF lesions. Visualization of lesion segmentation results on internal dataset Visualization of lesion segmentation results on external dataset #1 (WCHS) Visualization of lesion segmentation results on external dataset #2 (CS-SJTU) Label-efficiency analysis To further evaluate annotation efficiency, we conducted a label-efficiency analysis using 10%, 25%, 50%, and 100% of the internal training patients. As shown in Fig. S1 and Table S5, self-guided MS-SAMIM consistently outperformed MS-SAMIM without pre-training and random-mask pre-training across all labeled-patient fractions. The advantage was more evident under reduced-label settings: compared with no pre-training, self-guided MS-SAMIM improved Dice/IoU by + 6.11/+8.50 at 10% labels and + 4.59/+7.42 at 25% labels, whereas the improvement was + 1.84/+2.59 at the full-label setting. These findings indicate that the proposed self-guided pre-training strategy improves annotation efficiency and is particularly beneficial when pixel-level annotations are scarce. Statistical comparison Statistical comparisons were performed using the five matched patient-level trials. For each trial, Dice and IoU were calculated on the internal test set. Self-guided MS-SAMIM was compared with the strongest supervised baseline, Mask2Former, and the strongest self-supervised baseline, Swin-MAE. For each comparison, the paired difference was defined as self-guided MS-SAMIM minus the baseline. Means and sample standard deviations were reported. The 95% confidence interval of the paired mean difference was calculated using the t distribution with df = 4. Two-sided paired t-tests were performed using the five paired values, and p < 0.05 was considered statistically significant. As summarized in Table S9, self-guided MS-SAMIM significantly outperformed Mask2Former in Dice and IoU, with paired differences of + 0.85 and + 1.40% points and p-values of 0.0028 and 0.0006, respectively. It also outperformed Swin-MAE, with Dice/IoU differences of + 1.55/+2.11 and p-values of 0.0005/0.0001. Discussion In this study, we propose self-guided MS-SAMIM, a novel self-supervised pre-training framework designed to enhance OPMD lesion segmentation by leveraging unlabeled data. Our experimental results demonstrate that this approach achieves promising performance, surpassing both advanced fully supervised models and other SSL pre-training methods on the internal dataset (Table 5). The model also exhibited strong generalizability when validated on two independent external datasets (Tables 6 and 7). When situated within the broader context of self-supervised learning, our MIM-based approach has distinct advantages for this specific medical segmentation task. Pre-training strategies in SSL that rely on contrastive learning, including SimCLR and MoCo, generate positive sample pairs through data augmentation [25, 26]. These methods aim to maximize consistency between positive samples while minimizing similarity between different samples, thereby learning effective visual features. For example, Chaitanya et al. investigated a volumetric segmentation pre-training method on MRI datasets via contrastive learning strategies, which demonstrated advantages over approaches that are self-supervised and semi-supervised [27]. Schirris et al. developed a SimCLR-inspired contrastive self-supervised pre-training model for genomic status classification of H&E whole-slide images, which achieved superior results in MSI and HRD prediction [28]. However, relying only on contrastive learning may miss fine-grained local details, which can lead to less effective performance in dense prediction tasks such as semantic segmentation. Our results (Table 5) align with this understanding, where our method (84.35% Dice) significantly outperformed leading contrastive methods such as MoCov3 (79.80% Dice) and SimCLRv2 (81.04% Dice). Our method partially adopts the principles of contrastive learning: by incorporating contrastive loss into the encoder of the student model, we strengthen the model’s ability to capture the global semantic information of images. MIM methods include BEiT, SimMIM, and MAE [29–31]. This methodology involves masking specific regions of the source images, thereby teaching the model to restore the masked part and learn robust feature representations. In medical image research, MIM has been extensively studied [32]. Xu et al. implemented a MAE self-supervised pre-training model utilizing the Swin transformer as its core architecture for segmenting multicenter, multimodal MR images [33]. Tan et al. enhanced the MAE by incorporating self-distillation modules in both the encoder and decoder, achieving favorable results for COVID-19 medical image classification [34]. Chen et al. addressed vessel and surgical instrument segmentation by augmenting the MAE with additional semantic consistency supervision via a region adjacency graph and pseudo-masks [35]. Xing et al., considering the tendency of MIM to extract low-level semantic information, designed a masked learning method for multilevel semantic information extraction, and its performance was evaluated on five commonly used public benchmarks for medical image segmentation [36]. However, traditional MIM algorithms still face challenges for OPMD images: the scale of the OPMD dataset is incomparable to that of standard pre-training datasets for natural images such as ImageNet. Therefore, the feature extraction capability obtained through pre-training may be insufficient. Moreover, the random masking strategy in the MIM ignores the critical regional information of the input images as well as the intrinsic information of the model during the pre-training process, which presents certain limitations. Our self-guided MS-SAMIM was designed to address this problem. By shifting from purely random masking to a loss-guided strategy, our model becomes more data efficient and focuses learning on the most informative patches, mitigating the challenge of insufficient data. One potential risk of loss-guided masking is that regions with high reconstruction error may correspond to imaging artifacts—such as specular highlights from intraoral lighting or instrument reflections—rather than clinically meaningful lesion regions. Our framework mitigates this risk through three mechanisms: (1) a curriculum strategy that delays loss-guided masking until the teacher model has learned stable representations of basic image statistics; (2) maintaining a 50% random masking proportion to preserve stochasticity and prevent fixation on consistently hard but uninformative regions; and (3) the EMA-based teacher update, which temporally smooths transient noise in loss maps across training steps. Despite these promising results, this study has several limitations. First, the study was retrospective, and the images were collected from routine clinical practice rather than from a strictly standardized prospective imaging protocol. Differences in camera devices, shooting distance, illumination, focus, and intraoral exposure may therefore affect model performance. Second, although two external datasets were used for validation, all data were obtained from three Chinese clinical centers. Further validation on broader populations, different clinical workflows, and additional institutions is needed. Third, oral photographs often contain artifacts such as specular highlights, saliva reflections, mouth mirrors, gauze, retractors, teeth, and lips. Such artifacts can reduce segmentation accuracy, especially when they overlap with lesion boundaries. Fourth, although all images were annotated by experienced oral specialists and adjudicated when disagreement occurred, pixelwise lesion boundaries remain partly subjective, particularly for diffuse or poorly demarcated lesions. Fifth, the proposed model performs image-based lesion segmentation and should not be interpreted as providing a definitive diagnosis, dysplasia grading, or malignant transformation prediction. Histopathological examination remains necessary when clinically indicated. Finally, prospective studies are required to evaluate whether the system can improve screening efficiency, referral decisions, or clinical outcomes when integrated into real-world workflows. From a clinical workflow perspective, the proposed system is intended to serve as a decision-support tool rather than a replacement for oral specialists. In a potential application scenario, intraoral photographs acquired during routine dental examination, follow-up visits, or remote screening could be processed by the model to generate lesion-region overlays. These overlays may help clinicians localize suspicious areas, document lesion extent, monitor treatment-related changes, and prioritize patients who require specialist referral or biopsy. Such a tool may be particularly useful in primary care or resource-limited settings where experienced oral medicine specialists are not readily available. Nevertheless, the model only provides image-based lesion segmentation. It does not determine histopathological diagnosis, dysplasia grade, or malignant transformation risk. Clinical interpretation, biopsy decision-making, and patient management should remain under clinician supervision. Prospective clinical workflow studies are required to evaluate usability, safety, time efficiency, and impact on diagnostic decision-making. Moreover, there are still several meaningful directions for further research. First, to assess the model’s generalizability more seriously, future work should involve incorporating data from additional centers. Second, given the complexity of clinical OPMD diagnosis, integrating multimodal data could lead to an automatic diagnostic framework with enhanced reliability and predictive precision. Conclusions This study proposes a self-supervised pre-training methodology employing the masked image modeling approach to improve OPMD lesion segmentation. Comparisons with various semantic segmentation models and other visual self-supervised methods confirm the accuracy and robustness of our approach, with its generalizability validated on two external datasets. Our method can be extended to the widely existing model pre-training issue in medical image research, providing a potential technical basis for annotation-efficient oral lesion segmentation and future clinician-supervised decision-support systems. Supplementary Information Supplementary Material 1. Acknowledgements None. Abbreviations Oral Potentially Malignant Disorder Oral Squamous Cell Carcinoma Self-supervised Learning Masked Image Modeling Masked Autoencoder Vision Transformer Convolutional Neural Networks Stomatology Hospital, Zhejiang University School of Medicine Huaxi Stomatological Hospital, Sichuan Province Shanghai Ninth People’s Hospital Oral Leukoplakia Oral Lichen Planus Oral Submucous Fibrosis Intersection over Union Authors' contributions Y.C. contributed to the study by drafting the original manuscript, developing the methodology, and securing funding. M.L. was involved in drafting the manuscript, designing the methodology, and conducting the investigation. J.Z. contributed to validation and data visualization. R.Z. participated in the review and editing of the manuscript and supported funding acquisition. L.S. and H.D. were responsible for data curation and validation. P.H. provided essential resources and overall supervision. G.Z. contributed to software development and supervision. Q.C. played a role in project administration and data curation. All authors reviewed and approved the final version of the manuscript. Funding This work was supported by the Zhejiang Provincial Natural Science Foundation of China under Grant LQ24F030003, the National Natural Science Foundation of China under Grant 62303408, Science and Technology Special Project, Institute of Wenzhou, Zhejiang University under Grant XMGL-KJZX-202401, and the National Key Laboratory of Industrial Control Technology under Grant ICT2026A15. Data availability The data cannot be made publicly available upon publication because they contain sensitive personal information. The data that support the findings of this study are available from the corresponding author on reasonable request. Declarations Ethics approval and consent to participate The internal dataset used in this study was collected from oral mucosal disease patients at Zhejiang Stomatology Hospital. External dataset #1 was collected from Huaxi Stomatological Hospital, and external dataset #2 was collected from Shanghai Ninth People’s Hospital. The study was conducted according to the principles of the Declaration of Helsinki and complied with relevant medical ethics requirements. The Ethics Review Committee of Zhejiang Stomatology Hospital approved this study (Approval No.: 2024 − 117), the Ethics Review Committee of Shanghai Ninth People’s Hospital approved this study (Approval No.: SH9H-2025-T247-1) and the other participating centers agreed. Both the Ethics Review Committee of Zhejiang Stomatology Hospital and the Ethics Review Committee of Shanghai Ninth People’s Hospital waived the informed consent considering the retrospective nature of the study. Consent for publication Not applicable. Competing interests The authors declare no competing interests. Footnotes Publisher’s note Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations. Contributor Information Yuqi Cao, Email: yuqicao@zju.edu.cn. Rui Zhang, Email: zhangrui46@zju.edu.cn. References Associated Data Supplementary Materials Supplementary Material 1. Data Availability Statement The data cannot be made publicly available upon publication because they contain sensitive personal information. The data that support the findings of this study are available from the corresponding author on reasonable request.