An uncertainty-aware evaluation framework based on hierarchical vision transformers for robust cross-domain plant leaf disease classification Authors: Tripti Shrivastava, Ayush Kumar Agrawal, Abhinav Shukla, Parul Dubey Published: 2026 ABSTRACT AbstractPlant leaf disease detection is a critical task in precision agriculture, where reliable diagnosis under real-world conditions is essential for reducing crop losses and supporting timely intervention. Although deep learning models have achieved high classification accuracy, their performance often degrades under domain shift between controlled laboratory datasets and real-field environments, while predictive uncertainty and confidence calibration remain largely unaddressed.This study presents an uncertainty-aware cross-domain evaluation framework based on a Hierarchical Vision Transformer (HViT) for plant leaf disease classification. The framework integrates multi-scale feature learning with Monte Carlo Dropout-based predictive uncertainty estimation and temperature-based calibration to systematically analyze model behavior in terms of accuracy, reliability, and robustness. Experiments were conducted on two complementary datasets: the New Plant Diseases Dataset (controlled conditions) and the PlantDoc dataset (field conditions), enabling bidirectional cross-domain evaluation. Results demonstrate that the proposed framework achieves superior performance, attaining 97.8% accuracy on controlled data and 93.6% on field data, while significantly improving calibration with lower Expected Calibration Error (ECE = 0.032 / 0.041), reduced Negative Log-Likelihood, and lower Brier score compared to baseline CNN and transformer models. Furthermore, the framework exhibits improved robustness under domain shift, with reduced performance degradation and stable uncertainty behavior. Overall, this study highlights the importance of integrating uncertainty estimation and calibration within a hierarchical transformer-based framework, providing a more reliable and deployment-ready solution for real-world agricultural disease diagnosis.Keywords: Hierarchical vision transformer, Bayesian predictive calibration, Plant leaf disease classification, Uncertainty estimation, Cross-domain generalizationSubject terms: Computational biology and bioinformatics, Mathematics and computing Introduction Agriculture contributes nearly 4% of global GDP and supports the livelihoods of more than 2.5 billion people worldwide, while crop diseases are estimated to cause 20–40% annual yield losses, translating into economic damages exceeding USD 220 billion per year1,2. Leaf-based plant diseases are among the most visually detectable and economically destructive threats in crop production systems3. Automated image-based diagnosis has therefore emerged as a statistically scalable solution, where deep learning models attempt to approximate a function , mapping high-dimensional image input to discrete disease class labels . However, conventional deterministic classifiers provide only point estimates , without quantifying predictive uncertainty , which is critical in high-stakes agricultural decision-making. Furthermore, empirical studies show that classification accuracy can decline by 10–25% under domain shift, particularly when models trained on controlled laboratory images are deployed in real-field environments4,5. In this study, we adopt a framework-oriented approach, where a hierarchical vision transformer backbone is used within an uncertainty-aware evaluation pipeline to analyze performance, calibration, and robustness under domain shift. In recent years, with the rapid development of deep learning techniques, plant disease classification accuracy has been greatly improved3. Convolutional Neural Networks (CNN) achieve favorable performance on widely-used benchmark dataset, surpassing 95% accuracy in the controlled setting6. Nevertheless, CNN structures are locally receptive fields designed based, making use of the convolutional kernels for obtaining spatially-limited features. Although these architectures have shown excellent capability for texture-based disease identification, they might perform poorly in modeling long-range dependencies and global leaf deformations based on the level of diseases. Hierarchical Vision Transformers (ViTs), such as Swin Transformers, mitigate this limitation by learning self-attention that captures global semantic relationships among patches residing on all levels of different scales in an image. Hierarchical Vision Transformers additionally improve upon this by hierarchically aggregating patches, such that the model can learn across multi-scale representations – a necessary characteristic to be capable of modelling both localized lesion characteristics and large scale morphological deformations. However, two bottleneck problems are still open in plant disease classification. First, the vast majority of existing works are trained on single domain databases captured under controlled illumination and background clutter and perform poorly when tested on field-acquired images experiencing different lighting conditions, occlusions and background clutters. Second, the existing models work in a deterministic setting with high-confidence predictions for obscure or out-of-distribution samples. Overconfidence of this kind may result in wrong agronomic operations, economic loss and to the lack of trust for AI-based tools working inside agricultural systems. Thus, strong cross-domain generalization and uncertainty-aware prediction capabilities are crucial for real-world deployment. To this end, we utilize a Hierarchical Vision Transformer integrated with Bayesian predictive calibration within a unified evaluation framework. The model is based on a hierarchical transformer backbone to extract multi-scale features, and a Bayesian predictive layer for the epistemic uncertainty estimation based on the stochastic inference. Namely, predictive distributions are estimated as in equation (1). where denotes model parameters and represents the training dataset. We estimate posterior predictive mean and variance using a Monte Carlo sampling technique resulting in class predictions and their confidences. Prediction calibration is evaluated in terms of Expected Calibration Error (ECE), as well as Negative Log-Likelihood (NLL) and the Brier Score to ensure robustness under domain shift. We propose to introduce hierarchical transformer-based multiscale representation learning and Bayesian predictive calibration into a uniform framework of cross-domain plant disease classification evaluation. Figure 1 shows the hierarchical Vision Transformer for Bayesian uncertainty modeling and its application to real-world agricultural problems. Cross-domain hierarchical vision transformer with Bayesian calibration for robust plant disease classification. The central problem addressed in this study is not only to improve classification accuracy, but to evaluate how models behave under domain shift, particularly in terms of prediction confidence, calibration, and uncertainty. This requires a framework that simultaneously analyzes performance, reliability, and robustness across controlled and real-field datasets. Despite significant progress in plant disease classification, existing studies typically address only isolated aspects such as classification accuracy, transformer-based representation learning, or uncertainty estimation. The cross-domain generalization, predictive uncertainty quantification, and confidence calibration have been barely considered simultaneously, especially in the context of hierarchical transformer-based models. This lack of integration restricts the applicability of models to the real-field context where domain shift and decision uncertainty are relevant factors. Firstly, in contrast to earlier research that mostly emphasized the enhancement of classification accuracy in a single-domain setting, this paper is framed as a cross-domain assessment framework of plant disease classification. The goal is not to suggest a new learning paradigm, but to explore hierarchical transformer-based representations, predictive uncertainty estimation, and calibration mechanisms in a systematic study and how they all make robust model behavior when shifting to a different domain. Combining these elements into a single experimental framework, this study will focus on robustness, reliability, and deployment readiness, which have not been explored in the agricultural image classification literature. Instead of suggesting a radically novel deep learning architecture, this study aims to develop a unified evaluation system to jointly learn hierarchical features, estimate uncertainty, and analyze calibration to achieve strong cross-domain performance evaluation. There are four scientific contributions in this research: A hierarchical transformer-based framework for plant disease classification under both controlled laboratory and real-field conditions. A hierarchical transformer-based framework for plant disease classification under both controlled laboratory and real-field conditions. Integration of uncertainty-aware inference using Monte Carlo Dropout to assess predictive reliability. Integration of uncertainty-aware inference using Monte Carlo Dropout to assess predictive reliability. Systematic cross-domain evaluation between laboratory and field datasets to analyze robustness under domain shift. Systematic cross-domain evaluation between laboratory and field datasets to analyze robustness under domain shift. Calibration-focused evaluation using metrics such as Expected Calibration Error (ECE), Negative Log-Likelihood (NLL), and Brier Score. Calibration-focused evaluation using metrics such as Expected Calibration Error (ECE), Negative Log-Likelihood (NLL), and Brier Score. Comprehensive ablation and statistical analysis of classification performance, calibration quality, and uncertainty behavior. Comprehensive ablation and statistical analysis of classification performance, calibration quality, and uncertainty behavior. Together, this work is a step in the direction of plant disease classification as focused on deterministic accuracy maximization to uncertainty-aware, domain-robust, and practically deployable intelligent agricultural systems. Literature review The study of plant disease classification has evolved significantly with advancements in deep learning and computer vision. Recent approaches have focused on improving model accuracy, but challenges remain in handling domain shift, uncertainty, and calibration for reliable field deployment. Plant leaf disease classification in precision agriculture Automated identification of plant leaf disease is promising in precision agriculture and can response effectively, efficiently and scalably to the large scale monitoring of crops7. The AI-based diagnostic system is able to provide quick and real-time diagnosis, and it can effectively help stop the spread of diseases while also reducing crop losses8 since that the traditional methods requiring visual inspection by practicians or a lab test take time being subjective errors. Deep learning models (e.g., Convolutional Neural Networks as CNNs and attention-based transformers) have shown superiority in classification by utilizing discriminative patterns learned from large-scale corpus9. A maximum yield loss of 40% has been estimated for all major crops and result in enormous economic losses, >$220 billion per annum worldwide, and food security represents a huge risk with the increase in global population coupled with increasing demand for human food10. As a result, automated detection systems contribute to improve productivity and promote sustainable agriculture by allowing intervention in time and reducing chemical overdosage11. Paradigm shift of these human-eye-based-to AI-driven systems, computer vision techniques and data driven decisions could help in large-scale control, better reliability and improved robustness of new generation agriculture. Traditional machine learning approaches for plant leaf disease prediction Conventional modes of plant leaf disease prediction based on machine learning are mainly based on handcrafted feature extraction methods in conjunction with the classical classifiers12,13. The features related to the image are calculated for the demonstration of the patterns of disease, such as color histogram, statistical color texture (GLCM, SIFT, etc.), and shape, and so on. Classifiers such as Support Vector Machines (SVM), Random Forest (RF), and k-Nearest Neighbors (k-NN) use these handcrafted features14,15. Due to high reliability of a multiparametric space and its ability to hard classify, support vector machine (SVM) models have been widely adopted. The latter case is the Random Forest model that is more generalized whereas k-NN is a simple but relatively good classifier in smaller datasets. These techniques are promising in controlled laboratory, but they are cripplingly limited when used in the field16. The varying lighting, background-disorder, occlusions and leaf-orientation affect the strength of features and model-dependability. The class-imbalance of field data also bias predictions towards large classes. Moreover, manual engineered features are not dynamic to the complicated and heterogeneous disease patterns, which limits cross-domain generalization. Consequently, there is often a decrease in performance of classical machine learning approaches when applied to the real world of agriculture. Yet, these methods can only be used in a controlled setting and cannot be used to handle cross-domain variability, predictive uncertainty and confidence calibration so they are less applicable to real-field applications. Deep learning with convolutional neural networks Deep learning with Convolutional Neural Networks (CNNs)17 has been a significant step forward in plant leaf disease detection. It has been demonstrated that networks such as ResNet, EfficientNet and DenseNet, have good classification performance due to the deep hierarchical feature extracting process18. Using the method of residual connections ResNet solves the gradient vanishing issues to allow deeper and more stable dense networks19. Applying the search with evolutionary neural architecture and network design that is efficient to optimize balance between the depth, width, resolution and performance of the network20. The dense connectivity of DenseNet enables better feature reuse while it solves the vanishing-gradient issue which affects image classification performance. The CNN-based models demonstrated accuracy rates exceeding 98 to 99% when tested on the PlantVillage benchmark datasets which assess their performance under controlled testing conditions21. The two architectures enable us to achieve strong feature learning while our transfer learning and data augmentation efforts permit us to obtain good generalization results. The CNN models exhibit excessive confidence in their predictions when they encounter clean lab images and dogs from field images. The agricultural application of real-world systems faces two challenges because of domain shift which creates performance degradation and requires advanced computing power while small datasets provide unreliable results. The controlled datasets show high accuracy for CNN-based models but these systems display overconfidence with no ability to estimate uncertainty while their performance drops during domain shifts which makes them unsuitable for real-world farming operations. Vision transformers in agricultural image analysis Plant leaf disease prediction shows high popularity for Vision Transformers because of their advanced self-attention system which extracts complete image information. ViTs use a different approach than local convolutional filter based CNNs because they divide an image into patches and examine all connections between patches together with their joint examination22,23. The self-attention mechanism enables the system to understand both global long-distance dependencies and complex spatial patterns which are necessary to identify the subtle disease patterns on leaf surfaces24. The system represents features in a global manner that enables it to identify visually similar disease categories25. The initial ViT system requires quadratic time consumption because it processes image patches which makes it impossible to use with high-resolution farming photos26,27. Hierarchical transformer models, e.g. to counter this limitation. Swin Transformer implements window-based attention through its shifted window system28. This method enables effective descent which retains both local and global aspects of data according to research findings in29. The hierarchical architecture enables extraction of multiple feature scales which proves essential for modeling plant leaf lesions that exhibit various size and texture characteristics according to research from30. The empirical research shows that transformer-based models exceed CNNs in term of cross-domain generalization because they show greater strength in handling different tasks31. The technology functions properly with plant disease detection because it combines global attention with multi-scale representation through its aggregation capabilities. Transformer-based models create better global context understanding which improves generalization but existing methods still function as fixed systems which lack uncertainty estimation and calibration capabilities and they have not been tested for cross-domain performance. Base paper review The base paper introduces a deep learning framework which classifies plant leaf diseases through a deterministic hierarchical vision architecture that operates on controlled image datasets32. The study aims to increase classification accuracy by using better feature extraction methods together with improved network architecture design. The model functions under deterministic conditions because it excludes Bayesian uncertainty estimation and it does not use calibration metrics like Expected Calibration Error (ECE) or Negative Log-Likelihood (NLL) or Brier Score to assess prediction confidence. Furthermore, the study does not investigate model robustness under domain shift between controlled and real-field conditions. In contrast, the present work extends beyond architectural design by introducing an uncertainty-aware evaluation framework that systematically analyzes cross-domain performance, predictive uncertainty, and calibration. This not only makes the study an advancement with regard to evaluation and reliability analysis but also not just a suggestion of a different model architecture. Nevertheless, it does not collectively look at cross-domain robustness, uncertainty estimation, and calibration, which are paramount to real-world deployment. Table 1 provides a comparative summary of the current methods with their strengths and weaknesses with respect to cross-domain assessment, uncertainty modeling, and calibration analysis. Table 1Comparative analysis of existing approaches.Study typeBackboneCross-domain evaluationUncertainty modelingCalibration analysisDataset SettingKey limitationTraditional MLSVM, RF, k-NN✗✗✗ControlledPoor generalization, no uncertaintyCNN-based modelsResNet, EfficientNetLimited✗✗Mostly controlledOverconfidence, domain shift sensitivityVision transformersViT, SwinLimited✗✗MixedDeterministic predictions, no reliability analysisBayesian deep learningCNN/MLP✗✓LimitedGeneric datasetsNot tailored for hierarchical agricultural vision tasksCalibration methodsAny backbone✗✗✓GenericNot applied with cross-domain plant datasetsBase paperHierarchical DL✗✗✗ControlledNo uncertainty, no cross-domain evaluationThis studyHViT✓✓✓Controlled + FieldIntegrated evaluation framework Comparative analysis of existing approaches. The above comparison shows that the current research normally addresses specific issues like classification accuracy, representation learning, or uncertainty estimation. Nonetheless, there are a very limited number of papers that consider cross-domain robustness, predictive uncertainty, and calibration altogether. This is the gap that can encourage the current research to make a thorough assessment of reliability and performance in the actual agricultural environment. Dataset description We experimentally verify our hierarchical vision transformer with Bayesian predictive calibration framework on two publicly available datasets of plant leaf diseases both in a controlled laboratory and in the real-world scenario. New plant diseases dataset (controlled environment dataset) New Plant Diseases Dataset is a publicly available benchmark dataset on Kaggle, which is a large-scale dataset extensively utilized in plant leaf disease classification research33. It contains approximately 87,000 RGB images that are annotated by 38 disease classes in various crop species including tomato, potato, corn, grape and apple. The images were collected in a lab setup, with constant background, same lighting over the spread and low noise. There is a label for each image at the class level and the images are resized to a standardized size for deep learning training. The dataset is not heavily biased across classes and offers a stable training distribution and thus is suitable for supervised representation learning. Nevertheless, because it is collected in a controlled acquisition setup, the domain variability of it is small, and therefore can decrease its generalization performance when testing on real-field agricultural applications. PlantDoc dataset (field condition dataset) The PlantDoc dataset is a real natural field-based plant disease dataset34. It is an image-based single plant diseased dataset which consists of about 2500 RGB images for 17 plant species and covers altogether with 27 disease categories as well as multiple types of tomato leaf diseases. As opposed to lab-based collect images of PlantDoc contain complex backgrounds, natural illumination changes, occlusions and scale variation as well as camera viewpoint variations. Annotations are done at the image level, and certain versions of this dataset al.so include annotations of bounding boxes for disease localisation tasks. Due to its high intra-class variability and environmental noise, PlantDoc represents a domain distribution significantly different from controlled datasets. This renders it exceptionally appropriate in the context of assessing cross-domain generalization, robustness, and predictive calibration when applied in actual agricultural scenarios. Comparative dataset characteristics A combination of the two datasets facilitates cross-domain experimentation that is controlled to the field. Kaggle dataset is utilized in large-scale representation learning and pretraining, whereas PlantDoc is an effective benchmark of robustness to assess domain shift and uncertainty-aware performance. The comparison is given in Table 2. Table 3 provides a comprehensive overview of the distribution of the classes, their imbalance, and the complexity of the environment of the chosen datasets. Figure 2 depicts the figure samples. Table 2Comparative characteristics of the selected datasets.AttributeNew plant diseases dataset (Kaggle)PlantDoc datasetData sourceKaggle public repositoryPublic research datasetTotal images~ 87,000~ 2,500Number of classes3827Number of plant species14+17Tomato disease classesYesYesImage typeRGBRGBEnvironmentControlled laboratory setupReal field conditionsBackgroundUniform/cleanNatural/complexIlluminationConsistentVariableClass balanceRelatively balancedModerately imbalancedAnnotation typeImage-level classificationImage-level (some bbox annotations)Domain variabilityLowHighPrimary usage in this studyPretraining/supervised learningCross-domain evaluationDomain distributionptrain(x, y)pfield(x, y)Research roleFeature learning & calibration baselineRobustness & uncertainty validation Comparative characteristics of the selected datasets. Table 3Class distribution and dataset complexity analysis.DatasetNo. of classesNo. of speciesSamples per class (min–max–avg)Imbalance ratioTypical disease categoriesEnvironmental complexityNew plant diseases dataset3814+~ 1800–2500 – ~2300Low (≈ 1:1.6)Leaf spots, blights, rusts, mildewLow (clean background, uniform lighting)PlantDoc dataset2717~ 40–120 – ~90Moderate (≈ 1:2.1)Leaf spots, early/late blight, bacterial infectionsHigh (natural background, occlusion, lighting variation) Class distribution and dataset complexity analysis. Representative samples from the two datasets used in this study: (a) controlled environment images with clean background and consistent illumination, and (b) field environment images with natural clutter, occlusion, and lighting variability. These variations in the characteristics of datasets are very important in cross domain generalization. The controlled data set offers clean and well organized visual patterns, which allows good feature learning and the field data set presents real life issues like background clutter, occlusion, and variation in illumination. These aspects greatly enhance the intra-class variability and diminish model confidence in domain shift. Consequently, models trained on controlled data alone are likely to give overconfident forecasts in field conditions. This emphasises the need to integrate uncertainty estimation and calibration mechanisms since it will enable the model to capture more of the prediction confidence, and remain reliable in real-life situations involving agriculture. Uncertainty-aware evaluation framework This part will present the recommended uncertainty-conscious evaluation framework of the cross-domain plant leaf disease classification. The framework combines a hierarchical vision transformer backbone with predictive uncertainty estimation and calibration mechanisms, which allow one to systematically analyse the behaviour of the model in the case of domain shift. It is concerned with assessing the role of these components in accuracy, reliability, and robustness under realistic agricultural conditions. Figure 3 depicts the whole cross-domain learning process that involves the data set preparation (controlled and field images), pre-processing and augmentation, hierarchical vision transformer-based features, Bayesian inference with MC Dropout to estimate uncertainty, predictive calibration to enable credible decision-making in domain shift settings. Framework for uncertainty-aware cross-domain evaluation using hierarchical vision transformers. The suggested scheme adheres to the systematic flow beginning with the input preprocessing up to the final prediction. The input leaf plant image is initially resized and normalized and then subdivided into fixed-size patches and encoded into feature representations. Such embeddings undergo hierarchical transformer layers to learn multi-scale features. In inference, dropout is used to support stochastic forward passes, which can be used to approximate the posterior predictive distribution. To determine the probability of classes and uncertainty, predictive mean and variance are calculated. This is then followed by temperature scaling to scale confidence scores and finally a prediction and uncertainty estimates are generated to be used to do trustful cross-domain evaluation. Problem formulation Let an input RGB image be represented as Eq. (2) where: \:H= image height. \:H= image height. \:W= image width. \:W= image width. 3 = RGB channels. 3 = RGB channels. The classification objective is to learn a mapping as shown in Eq. (3). where: \:Kis the number of disease classes. \:Kis the number of disease classes. denotes model parameters. denotes model parameters. In deterministic models, prediction is computed as per Eq. (4). This means the predicted class is the one with the highest posterior probability. However, this approach does not quantify prediction confidence. To incorporate uncertainty, we aim to model the full posterior predictive distribution. This is shown in Eq. (5). where: denotes the input RGB image, \:Hand \:Wrepresent image height and width, denotes the class label, is the total number of disease classes, represents model parameters, denotes the training dataset, is the predictive likelihood, is the posterior distribution over model parameters. Hierarchical vision transformer backbone This component is responsible for multi-scale feature representation learning from input images. Patch embedding The image is divided into non-overlapping patches of size . The total number of patches is given by Eq. (6). where \:Pdenotes patch size and \:Nis total number of patches. This reduces high-dimensional image input into a sequence of smaller units. Each patch is flattened and projected into a feature vector. Equation (7) shows this in mathematical terms. where: = flattened patch. = flattened patch. \:E= learnable projection matrix. \:E= learnable projection matrix. = positional encoding. = positional encoding. This ensures spatial position information is retained. Multi-head self-attention Attention mechanism is defined as per Eq. (8). Where: \:Q= Query matrix. \:Q= Query matrix. \:K= Key matrix. \:K= Key matrix. \:V= Value matrix. \:V= Value matrix. = dimension scaling factor. = dimension scaling factor. The term computes similarity between patches. Dividing by stabilizes gradients. The Softmax function normalizes attention weights. Multi-head attention is computed as per Eq. (9). This allows the model to learn different representation subspaces simultaneously. Hierarchical structure Hierarchical transformers merge patches progressively. This is shown in Eqs. (10) and (11). where: LN = Layer Normalization. LN = Layer Normalization. MLP = Feed-forward network. MLP = Feed-forward network. Residual connections improve stability. Residual connections improve stability. This enables multi-scale feature extraction. Bayesian predictive inference with Monte Carlo dropout This component enables probabilistic prediction through stochastic forward passes for uncertainty estimation. To approximate posterior distribution, Monte Carlo dropout is applied. Monte Carlo approximation The posterior predictive distribution is approximated as per Eq. (12). where: \:T= number of stochastic forward passes. \:T= number of stochastic forward passes. sampled via dropout masks. sampled via dropout masks. This approximates Bayesian inference. Predictive mean The predictive mean represents the average class probability across stochastic passes. This is shown in Eq. (13). Predictive variance This measures epistemic uncertainty. High variance indicates model uncertainty. Equation (14) shows this. In this work, Monte Carlo Dropout is chosen to be used as a computationally efficient practical way to approximate the Bayesian inference in deep neural networks. MC Dropout has much lower computational complexity than other uncertainty estimation methods (including deep ensembles, variational inference, and fully Bayesian neural networks), and can be trained without structural changes to existing transformer-based systems. This renders it especially applicable to agricultural data, where computational power can be constrained and training large-scale ensembles can be prohibitive. Moreover, MC Dropout allows to make assumptions on epistemic uncertainty using repeated stochastic forward passes, which is a trustworthy approximation of model confidence, yet remains scaleable. Even more advanced methods of Bayesian are theoretically better guaranteed, but were not used in this work because of more training complexity, higher memory demands and lower applicability to real-world deployment situations. Temperature-based calibration This step improves the reliability of predicted confidence scores. For calibration, temperature scaling is applied as per Eq. (15). Here: are logits. are logits. \:Tis temperature parameter. \:Tis temperature parameter. Higher \:Tsmooths confidence. Uncertainty and calibration metrics These metrics quantify prediction reliability and calibration quality. Expected Calibration Error (ECE) is calculated mathematically as per Eq. (16). Where: = confidence bin. = confidence bin. = accuracy in bin. = accuracy in bin. = average predicted confidence. = average predicted confidence. Lower ECE indicates better calibration. Negative Log Likelihood (NLL) can be represented by Eq. (17). Measures how well predicted probabilities match true labels. Brier Score is computed with the help of Eq. (18). Measures squared difference between predicted probabilities and true labels. Bayesian predictive inference using Monte Carlo dropout. The above procedure illustrates how stochastic forward passes, predictive aggregation, and temperature-based calibration are integrated to generate reliable predictions along with associated uncertainty estimates under cross-domain conditions. Cross-domain evaluation protocol This protocol evaluates model robustness under domain shift between controlled and field datasets. Let: = Controlled dataset. = Controlled dataset. = Field dataset. = Field dataset. Domain shift is quantified as per Eq. (19). Increased uncertainty under domain shift validates Bayesian modeling. The overall framework follows a structured pipeline consisting of feature extraction, probabilistic inference, confidence calibration, and cross-domain evaluation, ensuring a systematic assessment of both performance and reliability. Experimental setup This experimental setup is sound to examine the performance of the proposed Hierarchical Vision Transformer within the proposed evaluation framework under both in-domain and cross-domain settings. Two types of public datasets collected from controlled laboratory and real-field agricultural environments were used for the diagnosis of domain shift robustness. All images were rescaled to 224 × 224 × 3, normalized with ImageNet statistics, and augmented with controlled geometric as well as photometric transformations for better generalizability. Stratified sampling was implemented and used to maintain the class distribution among training, validation, and testing sets. Domain robustness was assessed through a bidirectional cross-domain protocol, i.e., training on controlled and testing on field data as well as the reverse.The backbone of the hierarchical vision transformer (Swin-T variant) was initialized by ImageNet-pretrained weights. Bayesian predictive modelling was done using Monte Carlo dropout at inference time by conducting stochastic forward passes per sample to approximate the posterior predictive distribution. Final classification was performed using predictive mean and epistemic uncertainty with predictive variance. We measured the reliability of calibration using ECE, NLL, and the Brier score. The model was optimized with the AdamW optimizer with cosine annealing learning rate scheduling. Overfitting was prevented by early stopping based on the validation loss. All experiments were implemented in a GPU environment to make sure the efficiency of computations. Light experimental setting details (datasets, models, Bayesian settings, optimization schemes and evaluation protocols) are detailed in Table 4. Cross-entropy loss is minimized using Eq. (20). Table 4Experimental setup and implementation details.CategoryComponentSpecification/settingDatasetsControlled datasetNew Plant Diseases Dataset (~ 87,000 RGB images, 38 classes)Field datasetPlantDoc (~ 2,500 RGB images, 27 classes)Image resolution224 × 224 × 3Data split70% Train, 15% Validation, 15% Test (Stratified)Cross-domain protocolTrain-Controlled → Test-Field; Train-Field → Test-ControlledPreprocessingNormalizationImageNet Mean & StdAugmentationHorizontal/Vertical Flip (0.5), Rotation (± 15°), Color Jitter (± 20%), Random Crop (0.8–1.0 scale)Batch size32Model architectureBackboneHierarchical Vision Transformer (Swin-T)Patch size4 × 4Embedding dimension96Transformer stages4Classification headFully Connected + SoftmaxBayesian configurationBayesian methodMonte Carlo DropoutDropout rate0.3MC samples (T)30 stochastic forward passesPredictive mean Predictive varianceσ2 = Var(pt)OptimizationOptimizerAdamWInitial learning rate1e − 4Weight decay1e − 4SchedulerCosine annealingEpochs50Early stoppingPatience = 10Loss functionCross-entropyGradient clipping1Evaluation metricsClassificationAccuracy, Precision, Recall, F1-scoreCalibrationECE, NLL, Brier ScoreUncertaintyPredictive variance, confidence distributionRobustnessΔ Accuracy (domain shift impact)Hardware and softwareFrameworkPyTorchPython version3.9GPUNVIDIA RTX 3090 (24GB)CPUIntel i9RAM64 GBOSUbuntu 22.04CUDA11.x Experimental setup and implementation details. where: is ground truth label. is ground truth label. is predicted probability. is predicted probability. To ensure reproducibility of the proposed framework, the following implementation details are provided: Train/Validation/Test Split Procedure: Train/Validation/Test Split Procedure: The dataset was split into training (70%), validation (15%), and test (15%) subsets. The dataset was split into training (70%), validation (15%), and test (15%) subsets. Stratified splitting was performed to ensure that each class is proportionally represented in each subset. Stratified splitting was performed to ensure that each class is proportionally represented in each subset. 2.Image-Level vs. Class-Stratified Splits: Image-Level vs. Class-Stratified Splits: The splits were class-stratified, meaning the distribution of each class was preserved across training, validation, and test datasets. The splits were class-stratified, meaning the distribution of each class was preserved across training, validation, and test datasets. 3.Pretraining: Pretraining: No pretraining was used. The model was trained from scratch on the provided datasets to evaluate the generalization performance under real-world settings. No pretraining was used. The model was trained from scratch on the provided datasets to evaluate the generalization performance under real-world settings. 4.Number of Independent Runs: Number of Independent Runs: All experiments were conducted over 5 independent runs to account for variability due to random initialization and other factors. All experiments were conducted over 5 independent runs to account for variability due to random initialization and other factors. 5.Random Seed: Random Seed: A fixed random seed of 42 was used for all experiments to ensure consistent results across runs and experiments. A fixed random seed of 42 was used for all experiments to ensure consistent results across runs and experiments. 6.Inference Batch Behavior Under MC Dropout: Inference Batch Behavior Under MC Dropout: During inference, batch size = 32 was maintained. During inference, batch size = 32 was maintained. Monte Carlo Dropout was kept active during inference, enabling stochastic behavior of the model, where multiple forward passes are performed for each input to approximate epistemic uncertainty. Monte Carlo Dropout was kept active during inference, enabling stochastic behavior of the model, where multiple forward passes are performed for each input to approximate epistemic uncertainty. 7.Temperature Scaling: Temperature Scaling: Temperature scaling was learned on the validation set to calibrate the model’s output probabilities. Temperature scaling was learned on the validation set to calibrate the model’s output probabilities. The temperature parameter was optimized using cross-entropy loss on the validation set, then applied to the final test set for calibration. The temperature parameter was optimized using cross-entropy loss on the validation set, then applied to the final test set for calibration. Results and discussion In this section, we present a detailed analysis of the proposed HVT-BPC. The ablation studies are organized in the form of processing diagnostics, in-domain performance, cross-domain robustness, ablation comparison analysis, statistical validation study and comparative benchmarking and comparisons with paper. Preprocessing diagnostics, outlier detection, and model fit The quality and distributional properties of the data were pre-assessed prior to training. Outliers were observed in feature space using Mahalanobis distance, and model fit was confirmed via the Akaike Information Criterion (AIC). The distribution of the field dataset is more varied than that of the controlled dataset, presenting a real scenario. Table 5 shows various dataset complexity measures like class imbalance, outlier proportion, distributional dispersions (Mahalanobis distance), and the model comparison using AIC, supporting that our proposed Bayesian HViT outperforms all datasets, both control and field, using similar complexity measures. Table 5Dataset complexity, outlier characteristics, and model selection analysis.DatasetSamplesImbalance ratioOutliers (%)Mean Mahalanobis distanceAIC (CNN)AIC (ViT)AIC (proposed)Controlled87,00001:01.62.30%1.8415,84214,88014,112Field2,50001:02.15.80%2.476,9216,4115,988 Dataset complexity, outlier characteristics, and model selection analysis. The distribution and outlier analysis of the representative handcrafted and deep features extracted from the concatenated training set (controlled followed by field datasets) is shown in Fig. 4. The histograms illustrate the basic shape of the distribution for each feature, while boxplots show evidence of skew and outliers. Characteristically, lesion area and texture contrast manifest right-skewed behavior, while deep feature norms follow a Gaussian distribution. Bounding is good, as we are having limited uncertainty (not much displacement of curves) to get stable weighted Bayesian estimates. Distribution and outlier analysis of extracted lesion and deep features across domains. In-domain performance (baselines + proposed model merged) In-domain performance evaluation We compare the CNN, deterministic transformers, and Bayesian calibration transformer. The proposed model shows comparative advantage with respect to the performance and calibration measures. Figure 5 shows a comparison of baseline models like CNN (ResNet-50, EfficientNet-B0) and Vanilla ViT, along with the proposed Bayesian HViT on controlled and field datasets. Bars represent the metrics of the classification accuracy, F1-score (including on both the x-axis and secondary y-axis), and AUROC, while line lows show calibration/uncertainty metrics (ECE/NLL both column and line). Figure 5 illustrates the uniform progress of the Bayesian HViT in predictive performance and calibration skills, especially in the field—examples with clear domain shift—which is frequent. Table 6 shows that the proposed Bayesian HViT consistently outperforms each of the baseline CNN/Transformer approaches in terms of classification, calibration, and uncertainty performance under both controlled and field demonstrations. Cross-domain performance and calibration comparison across models. Table 6Performance comparison across controlled and field datasets.DatasetModelAccuracy (%)Precision (%)Recall (%)F1 (%)AUROCECE ↓NLL ↓Brier ↓Predictive entropyPredictive varianceControlledResNet-5094.894.594.294.60.9750.0820.340.0780.410.012EfficientNet-B096.195.995.895.90.9810.0750.290.0710.370.01Vanilla ViT96.496.296.196.20.9840.0710.270.0660.350.009Proposed Bayesian HViT97.897.697.597.60.9920.0320.180.0410.280.006FieldResNet-5088.988.28888.50.9120.1140.480.1240.620.021EfficientNet-B090.289.989.789.80.9250.1060.430.1180.570.019Vanilla ViT91.39190.8910.9360.0980.390.1090.520.017Proposed Bayesian HViT93.693.19393.20.9540.0410.250.0570.390.011 Performance comparison across controlled and field datasets. Cross-domain robustness Cross-training experiments were performed with the domain shift. Epistemic awareness is thus confirmed: Uncertainty grows as the domain deviates. Table 7 presents the results of cross-domain evaluations, highlighting how domain shift affects both prediction performance and calibration, specifically through Δ Accuracy for generalization degradation and mean predictive variance for uncertainty during distributional shifts. Table 7Cross-domain generalization and domain shift analysis.Train → testAccuracyF1AUROCECENLLΔ AccuracyMean varianceControlled → field90.189.60.9310.0670.32-7.70.015Field → controlled92.491.90.9460.0540.28-4.80.013 Cross-domain generalization and domain shift analysis. Detailed ablation study The ablation study examines the influence of each component. Each module contributes to a quantifiable improvement in digital device reliability and tolerance. Ablation analysis of hierarchical feature learning, Bayesian uncertainty modeling, and predictive calibration components that contributed to performance and reliability gains over both controlled experiments and field data are presented in Table 8. Figure 6 shows the incremental effect of adding components to the model architecture. On the left subplot, the line chart displays the Accuracy improvements for each model configuration, while the right subplot presents the calibration metrics (ECE, NLL, Brier Score) for each configuration. Table 8Ablation study of hierarchical and Bayesian components.DatasetMetricHViT Only+MC Dropout+CalibrationFull ModelControlledAccuracy (%)96.597.197.497.8AUROC0.9830.9880.990.992ECE ↓0.0740.0520.0410.032NLL ↓0.290.230.20.18Brier ↓0.0690.0550.0480.041Predictive entropy0.360.310.290.28Predictive variance0.010.0080.0070.006FieldAccuracy (%)91.792.693.193.6AUROC0.9340.9450.9510.954ECE ↓0.1180.0820.0560.041NLL ↓0.460.330.270.25Brier ↓0.1210.0830.0610.057Predictive entropy0.610.480.410.39Predictive variance0.020.0150.0120.011 Ablation study of hierarchical and Bayesian components. Ablation study—impact of components on accuracy and calibration metrics (ECE, NLL, Brier Score). Statistical significance testing Statistical significance testing was performed over multiple experimental runs to give a strong analysis of the reliability of the observed performance improvements. The investigation delves into the significance of the improvement over accuracy and calibration measures from randomness. The statistical validation of performance gains obtained by the proposed Bayesian HViT is shown in Table 9, which are statistically significant with respect to the classification accuracy and highly significant with respect to calibration error on both datasets. Table 9Statistical significance analysis of performance improvements.MetricDatasetMean improvementp-value95% CICohen’s dSignificanceAccuracyControlled1.40%< 0.01[0.9,1.8]0.72SignificantField2.30%< 0.01[1.6,2.9]0.81SignificantECEBoth− 55%< 0.001[− 0.06,− 0.03]1.15Highly significantNLLBoth− 33%< 0.001[− 0.12,− 0.07]1.08Highly significant Statistical significance analysis of performance improvements. Paired t-tests and Wilcoxon signed-rank tests were used to run all statistical comparisons in 5 independent runs. The significance level of 0.05 was set. The magnitude of the improvements was determined using Cohen effect size. Each performance measure had confidence intervals (95%). To establish whether the observed performance improvements in accuracy, F1-score, and calibration metrics were significant, statistical tests (paired t-test, Wilcoxon signed-rank) were conducted using random initializations and data splits. The effect size of these improvements was measured with the help of Cohen d. The strength and generalization of the proposed model were validated with statistically significant enhancements of accuracy and calibration measures. The effect size (d > 1) shows significant improvements in both the model performance and reliability. Table 10 shows these detailed results. Table 10Statistical testing results for model comparison.MetricModel 1 (proposed)Model 2 (Vanilla ViT)p-value (paired t-test)p-value (Wilcoxon)Cohen’s d95% Confidence intervalAccuracy0.950.90.0020.0051.2[0.03, 0.08]F1-Score0.910.850.0030.0061.3[0.02, 0.07]ECE0.0320.0450.0040.0081.5[0.002, 0.015]NLL0.120.180.0010.0021.4[0.03, 0.09]Brier Score0.040.060.0050.0071.1[0.01, 0.05] Statistical testing results for model comparison. Confusion matrix The confusion matrix analysis indicates that domain shift is extremely influential on the performance of the model when used in field settings. Thus, uncertainty estimation and temperature scaling in the proposed framework is essential in enhancing the accuracy and calibration of the predictions in more practical agricultural settings. The confusion matrices of the proposed model on the controlled and field datasets are presented in the Table 11 below. These matrices provide a view of the distinguishing capacity of the model to differentiate among the various plant diseases in both settings and identify the areas of confusion which can be explained by the environmental complexities like lighting variation, background clutter, and occlusion at field settings. Table 11Confusion matrix for the proposed model on controlled and field datasets.Predicted\actualClass 1Class 2Class 3Class 4Class 5Class 6Class 7Class KControlled dataset Class 125052101138 Class 2722010310038 Class 339290500238 Class 442524032438 Class 511232453438 Class 623454230638 Class 722120425038Field dataset Class 118030121057827 Class 220150181275327 Class 315201801068527 Class 410102519085727 Class 56958170111327 Class 67489121501427 Class 7557791017527 Confusion matrix for the proposed model on controlled and field datasets. Based on the table of performance by class, the proposed model can be seen to be performing strongly in most of the disease classes. The Class 1 (early leaf spot) and Class 3 (rust) have the highest accuracy and recall rates, which means that the model is reliable to detect these diseases in terms of sensitivity and specificity. Class 5 (bacterial blight), however, is a little less precise and recalls, which means that it misclassifies some similar diseases in the field data, presumably because of the complexity of the environment. Table 12 demonstrates this. Table 12Class-wise performance for the proposed model.ClassPrecisionRecallF1-ScoreAccuracyClass 1: Early Leaf Spot0.910.920.910.95Class 2: Late Leaf Spot0.880.850.860.92Class 3: Rust0.930.910.920.94Class 4: Powdery Mildew0.90.880.890.91Class 5: Bacterial Blight0.860.830.840.9Class 6: Downy Mildew0.870.850.860.89Class 7: Leaf Curl0.920.90.910.93 Class-wise performance for the proposed model. Failure case analysis under domain shift Heavy Occlusion: Model misclassifies due to occlusion by surrounding objects. Example: Class 1 (early leaf spot) was predicted as Class 2 (late leaf spot) with high uncertainty. Heavy Occlusion: Model misclassifies due to occlusion by surrounding objects. Example: Class 1 (early leaf spot) was predicted as Class 2 (late leaf spot) with high uncertainty. Low Lighting: Poor lighting conditions affect the model’s ability to detect lesions. Example: Class 3 (rust) was misclassified as Class 5 (bacterial blight) in low lighting. Low Lighting: Poor lighting conditions affect the model’s ability to detect lesions. Example: Class 3 (rust) was misclassified as Class 5 (bacterial blight) in low lighting. Multiple Lesions: Overlapping lesions confuse the model. Example: Class 4 (powdery mildew) was misclassified as Class 6 (downy mildew). Multiple Lesions: Overlapping lesions confuse the model. Example: Class 4 (powdery mildew) was misclassified as Class 6 (downy mildew). Background Interference: Environmental clutter misleads the model. Example: Class 2 (late leaf spot) was confused with Class 7 (leaf curl) due to background interference. Background Interference: Environmental clutter misleads the model. Example: Class 2 (late leaf spot) was confused with Class 7 (leaf curl) due to background interference. Visually Similar Diseases: Diseases with similar symptoms are misclassified. Example: Class 1 (early leaf spot) was predicted as Class 2 (late leaf spot). Visually Similar Diseases: Diseases with similar symptoms are misclassified. Example: Class 1 (early leaf spot) was predicted as Class 2 (late leaf spot). Mixed Infection Patterns: Mixed infections lead to misclassification of dominant disease. Example: Class 3 (rust) with Class 5 (bacterial blight) was misclassified as Class 3 (rust). Mixed Infection Patterns: Mixed infections lead to misclassification of dominant disease. Example: Class 3 (rust) with Class 5 (bacterial blight) was misclassified as Class 3 (rust). Comparative study summary Table 13 summarizes a qualitative comparison that illustrates the architectural, calibration, uncertainty modeling, and cross-domain robustness advantages of the proposed Bayesian HViT over conventional CNNs, deterministic transformers, and the base paper. Table 13Comparative analysis with existing approaches and base paper.AspectCNN modelsDeterministic transformerBase paperProposed Bayesian HViT (this study)Core architectureConvolutionalVision transformerDeterministic deep modelHierarchical vision transformerMulti-scale feature learningModerateHighModerateHigh (Hierarchical)Bayesian modeling✗✗✗✓ (MC Dropout)Predictive uncertaintyNoneNoneNot reportedEpistemic variance estimatedCalibration mechanismNoNoNot reportedTemperature scaling appliedExpected calibration error (ECE)HighModerateNot reportedLowest (0.032 / 0.041)Negative log likelihood (NLL)HighModerateNot reportedLowest (0.18 / 0.25)Brier ScoreModerateModerateNot reportedLowest (0.041 / 0.057)Accuracy (controlled dataset)94–96%96.40%95.20%97.80%Accuracy (field dataset)88–90%91.30%89.10%93.60%Cross-domain evaluationRareLimitedNot evaluatedBidirectional evaluation performedΔ Accuracy under domain shiftHigh dropModerate dropNot reportedReduced drop (-4.8 to -7.7)Statistical significance testingRareLimitedNot reportedt-test + effect size reportedRisk-aware decision support✗✗✗✓ (uncertainty thresholding)Real-world deployment suitabilityModerateModerateModerateHighNovelty contributionLowModerateModerateBayesian + calibration + domain robustness integration Comparative analysis with existing approaches and base paper. Visualizations of the qualitative prediction results of the proposed Bayesian HViT model on several representative test samples in the real world are illustrated in Fig. 7. The model provides confidence scores for the predicted class across all input images, which illustrates an ability to differentiate between visually similar disease patterns. The high confidence tending to well-classified samples also means good feature extraction and stable attention-based localization of disease lesions. In addition, the prediction probability is relatively stable even under difficulties in lighting conditions, occluded regions, and background environments; this suggests the possibility for the model to generalize well to uncontrolled environments. Such qualitative visualization is consistent with our quantitative results, being interpretable to show the real-world deployment efficiency of the model in practice. Qualitative prediction results with uncertainty estimates. Limitations and future work Though the performance of the proposed framework is satisfactory and substantially robust to cross-domain evaluation, it is evaluated on two publicly accessible datasets and still has its space that may be validated in a large-scale and more diverse real-field agricultural scenario. In the future, we will consider more lightweight model optimization, such as multimodal fusion (e.g., environmental data and soil data) and large-scale field deployment, to further improve the generalized practicability of our method. Limitations Despite the competitive performance of the Bayesian HViT on controlled and field datasets, it is limited to public benchmark datasets for evaluation. Nevertheless, these datasets cannot satisfy all the real-world variations, such as strong lighting variations, occlusions, mixed infections, and complex background noise that may appear in practical agricultural use cases. Although Monte Carlo Dropout improves uncertainty estimation, it adds computational load on inference that may limit deployment in resource-constrained (low-power) edge devices. In addition, the presented work is primarily dedicated to image-based diagnosis and does not integrate contextual agricultural indicators like weather conditions, soil type or crop developmental stage. Class imbalance in the rare disease categories is still an issue despite better calibration. Future work Future studies will focus on a large-scale field validation in different environments in order to increase generalizability. Efficient Bayesian approximations and low-cost model compression methods (e.g. pruning, quantization, knowledge distillation) will be also investigated to make possible real-time edge deployment. The incorporation of explainable AI techniques will contribute to increasing interpretability for agronomists and farmers. Furthermore, multimodal learning techniques integrating visual, weather and sensor data will be explored in order to increase robustness. Semi-supervised and incremental learning method will be employed as well to make the model generalize for unseen plant diseases. Real-world implications The proposed model has significant real-world applications in precision agriculture. By enabling smartphone-based diagnosis, it offers farmers a powerful decision support tool for early disease detection, potentially improving crop yield and reducing pesticide use. The model’s ability to provide uncertainty estimates ensures safer AI deployment in agriculture, allowing farmers to make informed decisions. When the model’s confidence is low, uncertainty triggers an expert review, preventing incorrect diagnoses that could lead to poor decision-making. This feature enhances the model’s reliability and promotes its safe integration into fieldwork. Furthermore, the ability to reject low-confidence predictions ensures that the system only provides actionable insights, reducing the risks of false positives in critical agricultural contexts. Conclusion We presented a Bayesian predictive calibration Hierarchical Vision Transformer for cross-domain plant leaf disease classification in this paper. It can well capture both local and global visual patterns by the use of hierarchical attention, and incorporate uncertainty estimation for improving its reliability in real-world situations. Experiments on Controlled and Field datasets show that our approach leads to better accuracy, calibration (lower ECE, NLL, Brier scores), and consistent uncertainty behavior than the typical CNNs and vanilla ViT baselines. This study does not aim to introduce a fundamentally new deep learning architecture, but rather demonstrates the importance of combining hierarchical representation learning with uncertainty estimation and calibration within a cross-domain evaluation framework. The results show that such integration significantly improves model reliability and robustness, which are critical for real-world agricultural deployment. The experimental results (qualitative analysis) also verify that the presented method can be applied in-field under various backgrounds and illumination, which makes the proposed approach practical for precision agricultural applications. Integrating transformer-based feature representation with uncertain probability estimation, the suggested model increases the prediction accuracy of crop classification and the confidence of farmers. Overall, we present a new deep learning model of plant disease diagnosis with any-device-anywhere and time-of-arrival completion that may be utilized to complement the future generation of intelligent crop monitoring systems. This paper discusses how it is crucial to consider deep learning models not only by their accuracy but also by their uncertainty and calibration in a single cross-domain context to enable real-world use of AI in agriculture. Author contributions Tripti Shrivastava conceptualized the study, performed data curation, implemented the proposed transformer-based modeling framework, conducted experiments, and drafted the initial manuscript. Ayush Kumar Agrawal and Abhinav Shukla contributed to methodology development, data preprocessing, experimental validation, result analysis, and assisted in manuscript revision. Parul Dubey supervised the research work, provided critical intellectual input on model design and clinical reasoning integration, validated the results, and reviewed and edited the manuscript for technical depth and clarity. All authors have read and approved the final version of the manuscript and agree to be accountable for all aspects of the work. Funding Open access funding provided by Symbiosis International (Deemed University). This research was funded by Symbiosis International University, India. Data availability The datasets used in this study are publicly accessible. The New Plant Diseases Dataset can be obtained from Kaggle at [https://www.kaggle.com/datasets/vipoooool/new-plant-diseases-dataset] (https:/www.kaggle.com/datasets/vipoooool/new-plant-diseases-dataset) . The PlantDoc dataset is available for download at [https://datasetninja.com/plantdoc#download] (https:/datasetninja.com/plantdoc) . Both repositories contain the images and labels necessary to reproduce the results presented in this work. Declarations Consent for publication All authors confirm that they have read the final version of the manuscript and give their full consent for its publication. No identifiable personal or private data of individuals are used in this study. Ethics approval and consent to participate This study does not involve human participants, human data, or animal experimentation. The research was conducted using publicly available plant image datasets. Therefore, ethics approval and informed consent were not required. 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. References Associated Data Data Availability Statement The datasets used in this study are publicly accessible. The New Plant Diseases Dataset can be obtained from Kaggle at [https://www.kaggle.com/datasets/vipoooool/new-plant-diseases-dataset] (https:/www.kaggle.com/datasets/vipoooool/new-plant-diseases-dataset) . The PlantDoc dataset is available for download at [https://datasetninja.com/plantdoc#download] (https:/datasetninja.com/plantdoc) . Both repositories contain the images and labels necessary to reproduce the results presented in this work.