Next Article in Journal
Blind Estimation of Multiuser Long-Code DSSS Signals via Subspace Reconstruction and ILSP
Next Article in Special Issue
JECCO-M: Integrated Optimization of Communication and Computational Energy in Wirelessly Connected Mobile Robots
Previous Article in Journal
Hand Gesture Recognition Based on Multi-Scale Attention Graph Convolutional Network
Previous Article in Special Issue
Blockchain-Based Assurance of Network Device Configuration Integrity
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

Cotton Leaf Disease Detection via Dual-Backbone CNN-Transformer Fusion with Quantitative XAI Comparison

1
Department of Electrical Engineering and Information Technology, University of Naples Federico II, via Claudio 21, 80125 Naples, Italy
2
Institute of High Performance Computing and Networking (ICAR), National Research Council (CNR), via Pietro Castellino, 111, 80131 Naples, Italy
*
Author to whom correspondence should be addressed.
Electronics 2026, 15(16), 3650; https://doi.org/10.3390/electronics15163650
Submission received: 21 July 2026 / Revised: 11 August 2026 / Accepted: 13 August 2026 / Published: 16 August 2026
(This article belongs to the Special Issue Advanced Computer Science and Intelligent Systems Innovations)

Abstract

Deep learning has shown promise for cotton leaf disease detection, yet two critical gaps remain. First, most studies rely on a single model (Convolutional Neural Network-CNN or Transformer) and do not explore how to effectively fuse these complementary architectures. Second, eXplainable AI (XAI) methods are often used qualitatively, lacking objective benchmarks to guide method selection. To address these gaps, we evaluate six backbone models, comprising four CNNs (ResNet50, EfficientNet-B0, DenseNet121, and MobileNetV2) and two Vision Transformers (ViT-Base and DeiT-Small), on the Kaggle cotton leaf disease dataset, which contains 1711 images across four classes. We then systematically investigate five CNN–Transformer fusion strategies, namely concatenation, attention, weighted, ensemble, and variance-based fusion, to identify the most effective approach for disease classification. The best-performing individual models are DenseNet121 (92.40% accuracy) and ViT-Base (96.49% accuracy). Classification metrics include accuracy, balanced accuracy, precision/recall, F1-score, Cohen’s kappa, MCC, AUC, bootstrap confidence intervals, and McNemar tests. Computational efficiency (FLOPs, inference time, model size) is also reported. Concatenation fusion achieves the highest performance (accuracy = 99.42%, 95% CI: 98.2–100%, weighted F1 = 0.994, MCC = 0.992). For explainability, we quantitatively compare six XAI techniques, GradCAM, GradCAM++, ScoreCAM, LayerCAM, EigenCAM, and AblationCAM, using the pointing game, IoU, AUC, and localization accuracy. EigenCAM yields the best overall explainability score. This study demonstrates that simple feature concatenation between dual backbones (CNN + Transformer) is highly effective for cotton leaf disease detection and provides a benchmark for XAI method selection in plant pathology.

1. Introduction

Cotton is one of the most important cash crops worldwide, serving as a primary source of natural fiber for the textile industry and contributing significantly to the economies of many countries [1]. However, cotton yields and quality are severely affected by numerous diseases, including bacterial blight, Fusarium wilt, and cotton leaf curl virus [2]. Because traditional disease diagnosis relies heavily on visual inspection by agricultural experts, this process is subjective, slow, labor-intensive, and difficult to scale [3]; therefore, development of intelligent and automated disease detection systems has become a priority in precision farming.
Deep learning (DL) architectures, specifically Convolutional Neural Networks (CNNs), have achieved state-of-the-art performance in extracting discriminative features from raw cotton leaf images [3,4]. Despite these advances, conventional CNN architectures possess inherent limitations. Standard CNNs struggle to model long-range dependencies and global context because convolution operations primarily capture local patterns within fixed receptive fields [5]. This limitation is problematic for plant pathology; disease symptoms often manifest as subtle texture variations distributed across multiple regions of a leaf, requiring models that can understand both local lesion characteristics and broader contextual information.
Recent studies have adopted Vision Transformers (ViTs), which employ self-attention mechanisms to model global interactions among image patches, thereby capturing long-range contextual dependencies more effectively [6]. However, Transformers are not without limitations. Their performance often depends on large-scale training data and substantial computational resources, and they may overlook fine-grained local details that are naturally captured by convolutional operations. Consequently, relying solely on either CNNs or Transformers may prevent the full exploitation of complementary feature representations.
To overcome these limitations, some recent works have proposed hybrid CNN–Transformer models, which combine the convolutional layers with Transformer blocks to use both local texture information and global contextual representation [6]. Nonetheless, most previous works focus on developing new hybrid architectures or attention modules but apply only a single method for the fusion of networks. Consequently, it remains uncertain whether the benefits are a result of the backbone architecture or of the particular feature fusion method adopted. In addition, there is still no study comparing different ways to combine CNN and Transformer within the same experimental protocol for the classification of diseases on cotton leaves. This limitation makes it difficult to identify which fusion mechanism provides the best trade-off between classification accuracy, computational efficiency, and model interpretability.
Another critical limitation of the existing approaches is the “black-box” nature of DL models, which limits transparency and trustworthiness [7]. In agricultural applications, explainability is particularly important because farmers, agronomists, and agricultural stakeholders require confidence that model predictions are based on biologically meaningful disease symptoms rather than spurious background correlations [8]. To address this, Explainable Artificial Intelligence (XAI) techniques have been widely adopted to visualize model attention and identify image regions that contribute most strongly to classification decisions. However, current agricultural XAI literature relies primarily on qualitative visual inspections (e.g., heatmaps) and does not perform objective quantitative evaluations [4]. This lack of rigorous benchmarking makes it impossible to systematically compare competing XAI methodologies or verify which technique provides the most statistically reliable localization of plant lesions.
This study extends our previously published work, which utilized meta-heuristic feature selection algorithms to optimize cotton leaf disease classification from DL representations [9]. While that foundational study established a robust baseline for cotton disease classification, it was constrained to standalone architectures and did not investigate hybrid CNN–Transformer configurations, feature fusion dynamics, or quantitative and qualitative explainability evaluation. The framework proposed here explicitly addresses these dimensions by co-optimizing predictive capacity and model explainability.
The proposed framework addresses two important research gaps in the current literature. First, unlike most existing hybrid CNN–Transformer studies that focus on designing a single architecture, this work systematically compares five fusion methods within a unified experimental framework, keeping the backbone models fixed. This enables the influence of the fusion mechanism itself to be analyzed independently of architectural variations, providing practical insights into the most effective strategy for cotton leaf disease classification. Second, although XAI techniques have been widely adopted in agricultural DL, their evaluation has been largely limited to qualitative visual inspection of heatmaps. In contrast, this work establishes a comprehensive explainability benchmarking framework that combines qualitative analysis with quantitative evaluation using Pointing Game, IoU, AUC, and Localization Accuracy. By jointly evaluating predictive performance, computational efficiency, and explainability, the proposed framework provides a more comprehensive benchmark for developing reliable and interpretable AI systems for precision agriculture.
The main contributions of this work are summarized as follows:
  • We perform a comprehensive comparative analysis of four CNN architectures (ResNet50 [10], EfficientNet-B0 [11], DenseNet121 [12], and MobileNetV2 [13]) and two Vision Transformer (ViT-Base [14] and DeiT-Small [15]) models for cotton leaf disease classification using a diverse set of classification and computational efficiency metrics.
  • We establish a unified benchmarking framework that systematically compares five fundamentally different CNN–Transformer fusion strategies, namely concatenation fusion [16], attention fusion [17], weighted prediction fusion [18], ensemble fusion [19], and variance-based fusion, using identical backbone models. This enables an unbiased assessment of the influence of the fusion mechanism independently of the backbone architecture.
  • We introduce a variance-based feature refinement strategy that selects informative feature dimensions according to activation variability, reducing feature redundancy while preserving discriminative information.
  • We conduct extensive performance evaluation using accuracy, balanced accuracy, precision, recall, F1-score, Cohen’s kappa, Matthews correlation coefficient, AUC, and bootstrap confidence intervals.
  • We provide a comprehensive computational complexity analysis of all individual and fusion models in terms of FLOPs, trainable parameters, inference time, and model size, facilitating practical deployment considerations.
  • We perform one of the first quantitative benchmarking studies of representative XAI techniques (GradCAM [20], GradCAM++ [21], Score-CAM [22], Layer-CAM [23], Eigen-CAM [24], and Ablation-CAM [25]) for cotton leaf disease diagnosis using Pointing Game, IoU, AUC, and Localization Accuracy metrics.

2. Related Work

Initial studies demonstrated the effectiveness of Convolutional Neural Networks (CNNs) for cotton disease detection. One of the earliest CNN-based frameworks employed GoogleNet and ResNet50 architectures for lesion recognition in field-acquired cotton leaf images. The approach significantly outperformed traditional machine learning methods such as SVM, KNN, ANN, and neuro-fuzzy classifiers [26]. Subsequent research focused on improving classification performance through transfer learning (TL), feature engineering, and optimization techniques. A meta-DL framework combining CNN architectures with meta-learning strategies achieved good performance on a dataset containing healthy and diseased cotton leaves, demonstrating improved generalization capability compared with conventional CNN models [27]. Similarly, TL combined with serial feature fusion and genetic algorithm-based feature selection was employed to identify cotton diseases from a self-collected dataset [28]. A newly developed dataset consisting of 2137 original images and over 7000 augmented samples was used to train an InceptionV3 model  [29].
A CNN-based model trained using K-fold cross-validation achieved satisfactory performance for detecting bacterial blight, spider mite, and leaf miner infestations in cotton plants [30]. More recently, ensemble-based CNN architectures have demonstrated remarkable performance across multiple cotton disease datasets. CottonLeafNet, an attention-enhanced CNN ensemble, achieved good accuracy while maintaining computational efficiency suitable for web-based deployment and real-time field applications [31]. Similarly, hybrid TL frameworks based on EfficientNet and InceptionResNet architectures have achieved classification accuracies around 98% while incorporating explainability mechanisms to enhance model transparency [32].
Recent studies have demonstrated the effectiveness of Transformer architectures for cotton disease classification. A comprehensive evaluation of multiple Transformer models, including Vision Transformers (ViTs), Swin Transformer, DeiT, and T2T-ViT, reported near-perfect classification performance on cotton leaf disease datasets when combined with stratified K-fold validation and transfer learning strategies [33]. Similarly, a large-scale cotton leaf dataset study compared several convolutional and Transformer-based architectures and found that ViT achieved the best performance  [34].
Several hybrid frameworks have recently demonstrated superior performance compared with standalone CNN or Transformer models. For example, a hybrid potato leaf disease architecture, PLDNet, integrated DenseNet-based convolutional feature extraction with a Transformer-based attention module and demonstrated strong performance across the PlantVillage and Mendeley datasets, highlighting the potential of combining local convolutional representations with global attention mechanisms for improved generalization [35]. Similarly, a hybrid framework combining EfficientNet-B7 for spatial feature extraction with ViT-B16 for global contextual modeling achieved higher performance than the corresponding standalone baselines on a large-scale dataset comprising 21,534 images from 38 plant disease and healthy classes [36]. ConvTransNet-S integrated convolutional feature extraction with lightweight self-attention mechanisms and multi-scale feature fusion and achieved the best accuracy on the PlantVillage dataset while substantially reducing computational complexity [37]. Likewise, a hybrid CNN-ViT architecture designed for cotton disease and pest classification outperformed individual CNN and Transformer counterparts [38]. Similar findings were reported by ConViT-based models that combined convolutional inductive biases with Transformer attention mechanisms, resulting in improved generalization and higher classification performance than standalone CNN and ViT architectures [39].
Recently, researchers have proposed the ResViT-152 architecture integrated convolutional feature extraction with Transformer-based global attention and achieved robust cross-dataset generalization across multiple crop disease datasets while simultaneously improving model interpretability through XAI techniques [40]. Furthermore, recent studies have introduced explainable hybrid frameworks such as XCottL-FebViT, which combines CNN-based hierarchical feature extraction with lightweight Transformer self-attention while incorporating explainability mechanisms to improve model transparency [41].
Recent studies have increasingly incorporated XAI into plant disease diagnosis to improve the transparency and practical reliability of DL models. For example, an adaptive PSO-LemonNetX framework combined DL, PSO-based feature selection, and LIME explanations for lemon disease classification, demonstrating the potential of integrating predictive performance, feature optimization, and explainability within a lightweight agricultural diagnosis system [4]. In hyperspectral disease analysis for complex intercropping systems, Transformer-based spectral–spatial feature extraction was combined with optimization and multiple XAI techniques, including LIME, SHAP, and Grad-CAM, while the consistency between activation maps and expert-marked disease regions was quantitatively evaluated using the Dice score [42]. Recent work has also highlighted the importance of reducing background bias in explainable plant disease classification. A bias-aware orange fruit disease framework employed LIME analysis to identify irrelevant background attributions and introduced background standardization to substantially reduce background-focused explanations, demonstrating that high classification accuracy alone does not necessarily guarantee reliable visual explanations [8]. In addition, frameworks integrating XAI techniques such as Grad-CAM, LIME, SHAP, and feature-importance analysis have demonstrated the potential to improve transparency and trustworthiness in cotton disease diagnosis systems [31,32,41,43].
Although current hybrid CNN–Transformer models consistently demonstrate the advantages of combining complementary local and global representations, several important research gaps remain. Existing studies typically propose and evaluate a single hybrid architecture or fusion design, with performance assessment primarily centered on classification accuracy. Comprehensive investigations comparing multiple CNN–Transformer fusion mechanisms under identical experimental conditions are still scarce. Similarly, recent studies have increasingly incorporated XAI techniques into plant disease diagnosis, and some have begun quantitatively validating explanation consistency against disease-relevant or expert-marked regions [42]. However, systematic benchmarking of multiple XAI methods using a common experimental setting and multiple complementary quantitative localization metrics remains limited. Consequently, it is still difficult to determine which explanation technique provides the most reliable and practically useful visual explanations for agricultural disease diagnosis. These limitations motivate the proposed framework, which systematically compares multiple CNN–Transformer fusion strategies and quantitatively evaluates different XAI methods using objective explanation-quality criteria. A tabular representation summarizing the above attributes and comparing the proposed approach with other existing ones is provided in Table 1.

3. Methodology

We propose a dual-backbone framework that fuses features from a DL model and a ViT for cotton leaf disease classification, combined with an extensive evaluation of XAI methods. The methodology consists of three main stages: (i) training and evaluating six individual DL models (four CNNs, two ViTs) to select the best-performing CNN and transformer; (ii) developing and comparing five fusion strategies that combine the selected backbones; and (iii) performing a qualitative and quantitative benchmark of six XAI techniques to assess model interpretability. The complete workflow of the proposed framework is illustrated in Figure 1.

3.1. Dataset Description

The experiments were conducted using the publicly available Cotton Leaf Disease dataset obtained from Kaggle. The dataset consists of 1711 RGB images representing four categories of cotton leaf conditions: bacterial blight, curl virus, fusarium wilt, and healthy leaves. The images were collected under natural field conditions, resulting in considerable variations in illumination, background clutter, viewing angle, leaf orientation, and disease severity. These variations make the dataset more representative of real agricultural environments while increasing the difficulty of the classification task.
Table 2 summarizes the class distribution of the dataset, whereas Figure 2 shows representative samples from the dataset. The dataset is relatively balanced, with each class containing approximately 400–450 images, reducing the risk of severe class imbalance during model training and evaluation.

3.2. Image Preprocessing and Data Augmentation

To ensure consistent input representation across all DL architectures, we resized each image to 224 × 224 pixels. We used several data augmentation strategies to improve model generalization and reduce overfitting. These augmentations included random horizontal flipping, random rotation, and color jittering operations.
Formally, let the input image be represented as I R H × W × C , where H, W, and C denote the image height, width, and number of color channels, respectively. The augmented image I ^ is obtained by applying a composite transformation operator:
I ^ = T ( I ) ,
where T ( · ) denotes the composite augmentation operator consisting of geometric and photometric transformations. After augmentation, the pixel intensities were normalized using the ImageNet channel-wise mean and standard deviation values as follows:
I norm = I ^ μ σ ,
where μ = [ 0.485 , 0.456 , 0.406 ] and σ = [ 0.229 , 0.224 , 0.225 ] denote the channel-wise mean and standard deviation, respectively.

3.3. Dataset Splitting

We divided the dataset into mutually exclusive training, validation, and test subsets before model development to support a fair and reproducible evaluation. We first manually separated a fixed test set comprising 10% of the images from each class using stratified sampling to preserve the original class distribution. This test set remained completely unseen throughout the entire development process and was used only once for evaluation after all models had been fully trained and optimized.
The remaining 90% of the data set formed the training pool and were further divided into training and validation subsets using stratified random sampling with a fixed random seed of 42 to ensure reproducibility. Specifically, 80% of the training pool was allocated for model training, while the remaining 20% was reserved for validation. Consequently, the overall distribution of the dataset corresponds to 72% for training, 18% for validation, and 10% for testing (Table 3). We determined the number of images in each subset by applying stratified sampling independently within each disease class, where we multiplied the class-wise image counts by the corresponding split ratios and rounded to the nearest integer while preserving the original class distribution.
We performed dataset splitting at the image level because the publicly available dataset does not provide plant-level or acquisition-session identifiers that would enable grouping images by the same plant or acquisition event. Consequently, although there is mutual exclusivity of the images at the subset level and despite the fact that stratified sampling was performed in order to maintain class distribution, it was not possible to check for a completely separate occurrence of images coming from the same plant or from very similar acquisitions. Likewise, near duplicate images or visual correlations in the dataset cannot be ruled out completely. Thus, the independent test set represents the generalization performance in the dataset, but more independent datasets would need to be tested for broader real-world generalization.

3.4. Deep Feature Extraction

We used four state-of-the-art CNN architectures, namely ResNet50 [10], EfficientNet-B0 [11], DenseNet121 [12], and MobileNetV2 [13]. We initialized these architectures with ImageNet-pretrained weights to use TL and accelerate convergence on the limited agricultural dataset. Given an input image I n o r m , the CNN backbone extracts hierarchical spatial features represented as
F c n n = ϕ c n n ( I n o r m ) ,
where ϕ c n n ( · ) denotes the CNN feature extraction function,   F c n n R d c represents the extracted feature vector, and d c denotes the dimensionality of the feature vector produced by the corresponding CNN backbone. We extracted the CNN feature vector from the global average pooling layer preceding the final classification head.
In addition to CNN models, we used two transformer-based architectures, i.e.,  ViT-Base [14] and DeiT-Small [15]. Unlike CNNs, transformer models utilize self-attention mechanisms to capture global contextual relationships across the entire image. The transformer feature representation is formulated as
F t r a n s = ϕ t r a n s ( I n o r m ) ,
where ϕ t r a n s ( · ) denotes the transformer feature extraction process and F t r a n s R d t represents the transformer embedding vector. The self-attention mechanism employed in transformer architectures is mathematically expressed as
Attention ( Q , K , V ) = Softmax Q K T d k V ,
where Q, K, and V represent query, key, and value matrices, respectively, while d k denotes the dimensionality of the key vectors.

3.5. Hybrid Feature Fusion Framework

To utilize the complementary strengths of CNN and transformer architectures, we investigated five different fusion strategies in this work. The complete workflow of the proposed CNN–Transformer fusion framework is summarized in Algorithm 1.
Algorithm 1 Dual-Backbone CNN-Transformer Fusion for Cotton Leaf Disease Classification.
Require: 
Training set D t r a i n , validation set D v a l , test set D t e s t ; pre-trained CNN models M C N N (ResNet50, EfficientNet-B0, DenseNet121, MobileNetV2) and Transformer models M T R (ViT-Base, DeiT-Small); number of epochs E i n d = 12 , E f u s = 15 ; batch size B = 8 ; learning rate η = 1 × 10 4 ; patience p = 3 .
Ensure: 
Best fusion model F * and its classification metrics.
 1:
Phase 1: Individual model training
 2:
for each m M C N N M T R  do
 3:
      Initialize m with ImageNet weights; freeze all layers except classification head.
 4:
      Train m on D t r a i n for E i n d epochs with early stopping on D v a l .
 5:
      Evaluate m on D t e s t ; record accuracy, F1, κ , MCC, AUC, and computational cost (FLOPs, inference time, model size).
 6:
end for
 7:
Select best CNN c * and best Transformer t * by test accuracy.
 8:
Phase 2: Feature extraction  Φ C N N ( x ) : forward x through c * to penultimate layer (after GAP), return feature vector f c R d c . Φ T R ( x ) : forward x through t * to penultimate layer (mean pooling over patches), return feature vector f t R d t .
 9:
Phase 3: Fusion model construction and training
10:
for each fusion method F { Concat , Attn , Weighted , Ensemble , Variance - Based Fusion }  do
11:
      if  F is Variance-Based Fusion then
12:
            Sample N = 30 images from D t r a i n .
13:
            Compute f c ( i ) , f t ( i ) for each sample.
14:
            Calculate per-dimension standard deviation σ j across samples for f c , τ k for f t .
15:
            Normalize each to [ 0 , 1 ] ; keep indices where normalized variance > 70th percentile (top 30% features).
16:
            Build mask M c , M t to select only those features.
17:
      end if
18:
      Create fusion model F combining c * and t * (concatenation, attention, weighted sum, averaging, or masked concatenation).
19:
      Train F on D t r a i n for E f u s epochs with early stopping on D v a l using cross-entropy loss, AdamW optimizer, and ReduceLROnPlateau scheduler.
20:
      Evaluate F on D t e s t : obtain predictions y ^ , probabilities p, and all metrics (including bootstrap 95% CI for accuracy and McNemar test against best method).
21:
end for
22:
Phase 4: Best model selection
23:
Identify F * = arg max F accuracy ( F ) . return  F * , detailed performance tables and figures.

3.5.1. Concatenation Fusion [16]

In this strategy, the CNN and Transformer feature vectors are concatenated to form a unified feature representation:
F fusion = F cnn F trans ,
where ⊕ denotes vector concatenation. The fused feature representation is subsequently passed through a multilayer perceptron (MLP) classifier [46] consisting of fully connected layers, ReLU activation functions, and dropout regularization.

3.5.2. Attention-Based Fusion [17]

We use an attention-based fusion strategy to dynamically learn the relative importance of CNN and Transformer representations using a cross-attention mechanism. To enable effective interaction between heterogeneous feature spaces, both feature vectors are first projected into a common latent representation space.
Given the CNN feature vector F cnn R d cnn and the Transformer feature vector F trans R d trans , the projected representations are computed as
F ^ cnn = W cnn F cnn ,
F ^ trans = W trans F trans ,
where W cnn R d × d cnn and W trans R d × d trans are learnable projection matrices, and d  denotes the shared latent dimensionality.
Subsequently, the query, key, and value representations are generated as
Q = W Q F ^ cnn ,
K = W K F ^ trans ,
V = W V F ^ trans ,
where W Q , W K , and  W V are learnable projection matrices for the query, key, and value transformations, respectively.

3.5.3. Weighted Prediction Fusion [18]

We used the weighted prediction fusion strategy, which combines the prediction logits generated by the CNN and Transformer branches using a learnable weighting coefficient:
Z f u s i o n = α Z t r a n s + ( 1 α ) Z c n n ,
where Z c n n and Z t r a n s denote the output logits of the CNN and Transformer models, respectively, while α [ 0 , 1 ] represents a trainable fusion coefficient optimized during backpropagation.

3.5.4. Ensemble Fusion [19]

We used the ensemble fusion strategy, which combines the prediction probabilities obtained from the CNN and Transformer branches using probability averaging:
P e n s e m b l e = P c n n + P t r a n s 2 ,
where P c n n and P t r a n s denote the softmax probability outputs of the CNN and Transformer models, respectively. The final predicted class is determined as
y ^ = arg max c P e n s e m b l e ( c ) ,
where P e n s e m b l e ( c ) represents the ensemble probability corresponding to class c.

3.5.5. Variance-Based Fusion

We used a variance-based feature selection strategy before feature fusion to improve computational efficiency and reduce redundant information. We estimated feature importance by analyzing the statistical variability of feature activations extracted from the CNN and Transformer branches. Specifically, the standard deviation of each feature dimension was computed across training samples. Features exhibiting higher activation variability were assumed to contain greater discriminative information for plant disease classification. The selected feature subset is defined as
F s e l e c t e d = { f i σ ( f i ) > τ } ,
where σ ( f i ) denotes the standard deviation of the i-th feature dimension and τ represents the selection threshold corresponding to the top 30 % of features. The threshold was selected based on preliminary experiments on the validation set, in which retaining the top 30 % of features yielded the best trade-off between classification performance and computational efficiency.
After feature selection, the refined CNN and Transformer feature representations were concatenated and forwarded to the classification network.

3.6. Explainability Framework

To improve model transparency and interpretability, we employed six gradient-based and activation-based explainability techniques, including Grad-CAM, Grad-CAM++, ScoreCAM, LayerCAM, EigenCAM, and AblationCAM.
To provide an objective comparison of XAI techniques, we adopted a quantitative evaluation framework comprising four complementary metrics: Pointing Game, Intersection over Union (IoU), Area Under the Receiver Operating Characteristic Curve (AUC), and localization accuracy. Given a heatmap H R H × W produced by an XAI method and a binary ground-truth mask G { 0 , 1 } H × W indicating disease-affected regions, the Pointing Game metric assesses whether the maximum activation location falls within the diseased area:
PG ( H , G ) = 1 , if G [ arg max ( H ) ] > 0 , 0 , otherwise .
The IoU metric measures the spatial overlap between the binarized heatmap and the ground-truth mask:
IoU ( H , G ) = | H b G | | H b G | ,
where H b denotes the binarized heatmap. The AUC evaluates the ranking quality of heatmap activations relative to ground-truth disease regions:
AUC ( H , G ) = 0 1 TPR ( t ) d FPR ( t ) ,
where TPR and FPR denote the true positive and false positive rates across varying thresholds. The localization accuracy measures the proportion of the disease regions covered by the top k % of heatmap activations:
LA ( H , G ) = | H top k G | | G | ,
with k = 20 % in our experiments. The threshold value used was chosen based on preliminary experiments, whereby the top 20% heatmap activations offered a balance between disease-related regions and background regions that should be excluded.
Given that the dataset for cotton leaf diseases lacks pixel-level annotations, we decided to create artificial ground-truth masks using a two-element model. The main element is an ellipse whose focus is at the center of the image, with the semi-major axis equal to one-third of the width and the semi-minor axis equal to one-fourth of the height. Secondary elements involve the creation of random circular patches with sizes between 10 and 30 pixels. This mask generation strategy simulates the spatial characteristics of leaf diseases, which typically manifest as localized lesions distributed across the leaf surface.
All four metrics were calculated for each of the XAI techniques for each image that was used. The average value was then calculated for all the images. This was done for all the XAI techniques. We therefore obtained a total of four values for each XAI technique. To determine the overall ranking of the XAI methods, we calculated the average of these four metrics. The complete procedure for generating the XAI explanations, computing the quantitative evaluation metrics, and ranking the explainability methods is summarized in Algorithm 2.
Algorithm 2 Quantitative Comparison of XAI Methods for Model Interpretability
Require: 
Best fusion model F * (from Algorithm 1); test set D t e s t ; K classes ( K = 4 ); number of samples per class S = 3 ; set of XAI methods X = { GradCAM , GradCAM + + , ScoreCAM , LayerCAM , EigenCAM , AblationCAM } ; target layer L (last convolutional layer of CNN backbone).
Ensure: 
Quantitative scores and ranking for each XAI method.
 1:
Data preparation
 2:
Randomly select S images from each class in D t e s t → total N = K × S images.
 3:
for each selected image I with true class y t r u e  do
 4:
      Preprocess I to 224 × 224 and normalize (ImageNet stats).
 5:
      Generate synthetic ground-truth mask G: central ellipse + random circular spots (3–8 spots, radius 10–30 pixels).
 6:
      Store I, y t r u e , and G.
 7:
end for
 8:
Saliency map generation
 9:
for each image I in the selected set do
10:
      Forward I through F * to obtain predicted class y p r e d .
11:
      for each XAI method X m X  do
12:
            Compute saliency map H m using X m with target y p r e d and layer L.
13:
            Resize H m to 224 × 224 (if needed) and normalize to [ 0 , 1 ] .
14:
            Overlay H m on I for visualisation (stored separately).
15:
      end for
16:
end for
17:
Quantitative evaluation
18:
for each image I and each method X m  do
19:
      Pointing Game: P G = 1 arg max H m G .
20:
      IoU: binarise H m at threshold 0.5 → B; IoU = | B G | | B G | .
21:
      AUC: treat H m as score map, G as binary ground truth; compute ROC-AUC.
22:
      Localisation Accuracy: L A = ( u , v ) 1 [ H m ( u , v ) > τ ] · G ( u , v ) | G | , where τ is the 80th percentile of H m (top 20% pixels).
23:
end for
24:
Aggregation and ranking
25:
for each method X m  do
26:
      Compute mean μ P G , μ I o U , μ A U C , μ L A across all images.
27:
      Combined score C m = ( μ P G + μ I o U + μ A U C + μ L A ) / 4 .
28:
end for
29:
Rank methods by C m (higher is better). Generate boxplots per metric and bar chart of C m .
      return Ranking list, average metrics table, and saliency map gallery.

4. Results

This section evaluates the performance of the proposed framework through systematic experimental trials. All experiments were conducted with system specifications summarized in Table 4. Furthermore, the experiments were implemented using PyTorch (v1.13.0) [47] and the timm library for Transformer models. All models were trained with the hyperparameters shown in Table 5.

4.1. Implementation Details

All experiments were implemented using the PyTorch deep learning framework and executed on a desktop computer equipped with an Intel® Core™ i5-5200U CPU, 8 GB RAM, and running Windows 10 (64-bit). No dedicated GPU was used during model training or evaluation (Table 4).
To ensure a fair comparison among the investigated backbone networks, identical optimization settings were employed for all individual models, including ResNet50, EfficientNet-B0, DenseNet121, MobileNetV2, ViT-Base, and DeiT-Small. Specifically, all models were trained using the AdamW optimizer with an initial learning rate of 1 × 10 4 , a batch size of 8, weight decay of 1 × 10 5 , the ReduceLROnPlateau learning-rate scheduler (factor = 0.5, patience = 2), and early stopping with a patience of three epochs. Individual backbone networks were trained for 12 epochs, while the proposed fusion models were trained for 15 epochs.
All backbone models were initialized using ImageNet pretrained weights provided by the PyTorch torchvision library. The original classification layer of each network was replaced with a task-specific classification head corresponding to the four cotton leaf disease classes, and the entire network was fine-tuned during training.
On the CPU-only system described in Table 4, the measured training time for the individual backbone models ranged from approximately 19 to 105 min per training run, depending on the architecture. Among the evaluated models, MobileNetV2 required the least training time (approximately 19 min), whereas ViT-Base required the longest (approximately 105 min), reflecting the higher computational requirements of the Transformer architecture. These measurements are representative of the training time observed across the evaluated backbone models.
To ensure full reproducibility, we set a fixed random seed of 42 for all experiments. The same seed was used for dataset splitting, model initialization, and bootstrap resampling. The model-selection procedure consisted of first training all individual CNN and Transformer models on the training set, evaluating them on the validation set, and selecting the best-performing CNN and Transformer based on validation accuracy. These selected backbones were then used as fixed feature extractors for all fusion models, which were trained and evaluated under identical conditions. The final best fusion model was selected based on test accuracy.

4.2. Evaluation Metrics

The following notation is used throughout the evaluation metrics: T P , T N , F P , and F N denote true positives, true negatives, false positives, and false negatives, respectively. C represents the number of classes, while T P i and F N i indicate the true positives and false negatives for class i. For Cohen’s Kappa, p o denotes the observed agreement and p e represents the expected agreement by chance. In the ROC-based metrics, TPR and FPR denote the true positive rate and false positive rate, respectively. For XAI evaluation, H and M represent the heatmap and binary ground-truth mask, respectively. Table 6 summarizes the diverse set of metrics used in this work, their descriptions, and the corresponding formula or unit.

4.3. Performance Evaluation

The experimental results demonstrate the effectiveness of the proposed CNN–Transformer fusion framework for cotton leaf disease classification. For the 95% bootstrap confidence intervals reported in the results tables throughout this section, we employed the percentile bootstrap method with 500 resampling iterations. In each iteration, we randomly sampled test set predictions with replacement at the individual image level, recomputed the accuracy on the resampled set, and then constructed the confidence bounds using the 2.5th and 97.5th percentiles of the resulting bootstrap distribution.
At first, we evaluated the effectiveness of six different DL architectures, namely four CNNs and two Transformer-based neural networks. The detailed classification performance is reported in Table 7, while the computational characteristics of the individual models are summarized in Table 8.
Out of all the individual models, Transformer-ViT-Base showed the best results in terms of accuracy with values of 96.49 % for accuracy, 0.9642 for the macro F1 score, 0.9534 for MCC, and 0.9995 for weighted AUC. This proves the excellent representational learning capability of Transformer architectures for complex disease recognition tasks. In contrast, CNN-based models demonstrated comparatively lower performance, although DenseNet121 and EfficientNet-B0 achieved competitive results with accuracies above 90%. MobileNetV2 exhibited the lowest computational complexity, making it suitable for lightweight deployment scenarios. However, this reduction in complexity was accompanied by a moderate decrease in classification performance. Although ViT-Base achieved the best predictive performance among all individual models, it also incurred the highest computational cost and an inference time of 346.87 ms.
The detailed classification performance and computational complexity analysis of the fusion models are presented in Table 9 and Table 10, respectively. The fusion results demonstrated substantial performance improvements over all standalone architectures, confirming that CNN and Transformer representations provide complementary discriminative information. In particular, the concatenation fusion strategy achieved the best overall performance with an accuracy of 99.42 % , macro F1-score of 0.9940 , MCC of 0.9922 , and weighted AUC of 0.9999 .
To ensure full transparency, we examined the exact classification outcomes for the best-performing Concatenation Fusion model. Out of the 171 test samples, 170 were correctly classified, and only 1 was misclassified, yielding an accuracy of 99.42%. The single error corresponded to a healthy leaf sample that was incorrectly predicted as curl_virus. This near-perfect classification performance is consistent with the bootstrapped 95% confidence interval of 98.2–100.0% reported in Table 9 and confirms the robustness of the proposed fusion approach.
The variance-based fusion strategy also achieved highly competitive performance with an accuracy of 98.83 % and MCC of 0.9845 , demonstrating that explainability-driven feature refinement can effectively reduce redundant representations while preserving highly informative disease-related features. Similarly, the ensemble fusion strategy achieved strong classification performance with an accuracy of 97.66 % , suggesting that prediction-level aggregation improves robustness and generalization. In contrast, weighted fusion exhibited comparatively lower performance than feature-level fusion methods, indicating that directly combining logits may not fully exploit the complementary spatial and contextual representations learned by CNN and transformer backbones.
Although the fusion approaches significantly improved classification performance, they also introduced higher computational complexity due to the simultaneous utilization of dual backbones. All fusion models required approximately 19.7 G FLOPs and more than 92M trainable parameters. Among the fusion strategies, ensemble fusion achieved the lowest inference time of 500.81 ms, while the variance-based fusion model exhibited the highest inference cost because of the additional feature refinement operations. Nevertheless, the substantial improvement in predictive performance justifies the increased computational overhead, particularly for high-accuracy agricultural disease diagnosis systems.
It is important to note that for computational complexity analysis, the parameter counts and FLOPs were calculated for the final model architectures used in the experiments. For each pretrained backbone, the original ImageNet classification head was replaced with the task-specific classification layer before training. Accordingly, the reported computational statistics for the fusion models include the parameters and operations of both modified backbone networks together with the additional fusion and task-specific classification layers, where applicable. The reported counts (Table 8 and Table 10) therefore do not represent the original ImageNet models with their original classification heads.
Overall, the obtained results confirm that integrating CNN-based local feature extraction with Transformer-based global contextual modeling substantially improves cotton leaf disease classification performance. The proposed fusion framework consistently outperformed all standalone architectures across all evaluation metrics, while the concatenation fusion strategy achieved the best balance between discriminative capability and classification robustness. These findings demonstrate the effectiveness of hybrid CNN–Transformer learning for intelligent agricultural disease diagnosis systems.

4.4. Explainability Analysis

To investigate how different explainability techniques identify disease-relevant regions while suppressing irrelevant background information, we performed a qualitative comparison using six widely adopted XAI methods: GradCAM, GradCAM++, ScoreCAM, LayerCAM, EigenCAM, and AblationCAM. We selected representative samples from the cotton leaf disease dataset to visually examine the spatial distribution of model attention.
Figure 3 presents the explanation maps generated by the six approaches for three representative test images, all correctly classified as bacterial blight. The figure is organized with each row corresponding to a test sample, and columns displaying the original image, followed by the heatmaps from each XAI method.
There is one important observation that can be made about background suppression after performing qualitative analysis. Techniques like GradCAM, GradCAM++, ScoreCAM, LayerCAM, and AblationCAM consistently resulted in activation maps that overlapped into the background area. The presence of this noise showed that the methods do, at times, give high importance to areas that are not leaf parts, thus making their explanations for localizing the diseases inconsistent. However, the EigenCAM algorithm produces very restricted and accurate activation maps only within the leaf area. By producing zero or negligible attention outside the leaf area, EigenCAM effectively eliminates false-positive attributions from the background.
Even though these models have background leakage, GradCAM++ and ScoreCAM have sharper activations of the lesion-specific features within the leaf, but their inability to eliminate the background interference means that they are not suitable for exact mapping of the disease. The EigenCAM model is the best since it combines both plant anatomy and lesion features. This behavior suggests that EigenCAM inherently captures the model’s spatial grounding more faithfully, making it particularly suitable for plant disease detection where distinguishing the target object (the leaf) from the background is essential for trustworthy explanations.
Overall, while GradCAM++ and ScoreCAM provide strong intra-leaf localization, EigenCAM outperforms them in terms of spatial contextuality by avoiding irrelevant background activations. The quantitative metrics reported in the bottom table further substantiate these visual observations.
Furthermore, to objectively assess the localization performance of the six XAI methods, we performed a quantitative evaluation using four complementary metrics: Pointing Game, IoU, AUC, and localization accuracy. These metrics evaluate different aspects of explanation quality: Pointing Game measures whether the maximum activation falls within the ground-truth region; IoU quantifies spatial overlap between binarized explanations and disease regions; AUC assesses the overall ranking of pixel importance; and Localization Accuracy measures the coverage of ground-truth regions by the top-k% most activated pixels.
Table 11 presents the average performance of each method across all test samples. The results reveal distinct performance characteristics across methods, with EigenCAM consistently achieving the highest scores in the most critical metrics.
EigenCAM exhibits superior performance compared to other methods based on all four criteria and proves its ability to localize diseases more precisely. EigenCAM scores 0.750 in the Pointing Game criterion, meaning that in 75% of test cases, this method is able to detect the most discriminative part of the disease location area. This method significantly outperforms GradCAM and AblationCAM, scoring 0.583 and 0.500, respectively. However, EigenCAM achieves the best IoU (0.457), AUC (0.806), and Localization Accuracy (0.613), implying that the attention maps generated by it not only successfully localize the areas affected by diseases but also maintain fine-grained alignment with the ground truth.
While gradient-based algorithms like GradCAM and GradCAM++ utilize the propagation of gradients through the network which are themselves subject to problems related to noisy and vanishing gradients, EigenCAM calculates the first principal component of the activations of the target convolutional layer. In doing so, it extracts the most prominent variation in the feature space, thus successfully filtering out any background noise to concentrate only on the most discriminative features. As a result, the explanation maps produced by EigenCAM are extremely precise and contextually accurate due to their high scores.
GradCAM++ and ScoreCAM exhibit competitive performance, particularly in terms of AUC (0.742 and 0.750, respectively) and IoU (0.451 and 0.435). GradCAM++ ranks second to the highest IoU, implying that the gradient weighting method used by GradCAM++ produces attention maps with high spatial agreement with the diseased regions. ScoreCAM, where gradients are replaced by forward pass perturbation scores, performs very well in ranking pixel importance (AUC = 0.750).
LayerCAM and GradCAM fall somewhere in the middle, with GradCAM obtaining the best score of the Pointing Game (0.583) among all approaches except EigenCams, whereas IoU and localization accuracy scores (both 0.330) remain quite low for GradCAM. It indicates that while GradCAM correctly locates the correct region most of the time, its attention regions usually tend to be large and not as precisely located around the lesion boundaries.
Among all models, the AblationCAM demonstrates the worst result by showing the smallest IoU (0.322), AUC (0.638), and localization score (0.301). Such a result can be caused by the fact that AblationCAM uses iterative ablation of the feature maps and, therefore, is sensitive to the perturbation methods used.
Ranking results shown in Table 12 represent an integrated approach that takes into account all four criteria altogether. EigenCAM becomes the clear leader with an overall score of 0.906, outperforming GradCAM++ by a wide margin (GradCAM++ achieves second place with a value of 0.707).
Interestingly, the qualitative observations align well with the quantitative findings. EigenCAM’s strict confinement of attention to leaf surfaces, as visually observed in Figure 3, is quantitatively validated by its superior IoU and localization accuracy scores. The background leakage observed in GradCAM, GradCAM++, ScoreCAM, LayerCAM, and AblationCAM is reflected in their lower IoU values, as the spurious background activations reduce the spatial overlap with ground-truth disease regions.
These findings have significant implications for the selection of appropriate XAI techniques in agricultural AI applications. Although GradCAM-based techniques are commonly used on account of their ease and efficiency, the thorough analysis conducted by us reveals that EigenCAM is far superior in terms of reliability and accuracy. EigenCAM is well suited for practical applications where plants are often photographed within their natural environment because of its capacity to ignore background distractions while still being highly sensitive to disease-related features. The method’s inherent ability to capture the most salient feature variations through principal component analysis provides a principled approach to explainability that is less susceptible to the limitations of gradient-based or perturbation-based methods. In summary, the quantitative evaluation establishes EigenCAM as the most effective XAI method for cotton leaf disease classification, achieving superior performance across all evaluated metrics.

5. Discussion

The experimental findings yield a number of important conclusions concerning the effectiveness of CNN–Transformer fusion, the significance of different fusion techniques, and the practical application of XAI-based approaches to classification of cotton leaf diseases. In contrast to earlier studies where emphasis is placed on the development of new hybrid models, this study evaluates various fusion methods within one experimental setup. In conclusion, the major contribution of this study is therefore not the introduction of a fundamentally new CNN, Transformer, fusion, or XAI algorithm, but the systematic empirical investigation of established fusion strategies and explainability methods under a unified experimental protocol.

5.1. Interpretation of CNN–Transformer Fusion Performance

The higher efficiency of the concatenation method of fusion is possible due to the property of maintaining complementarity between CNN and Transformer-based representations. Indeed, CNNs possess natural advantages in identifying local spatial relationships within images in terms of textures, lesions, and other fine disease structure information. In contrast, Transformers learn dependencies across the image areas by means of self-attention processes. Thus, using the simple concatenation of the output of DenseNet121 and ViT-Base models, we maintain all the information in both feature spaces without any additional assumptions concerning feature weights. This observation explains why concatenation fusion achieved the highest classification performance, obtaining an accuracy of 99.42%, MCC of 0.9922, and weighted AUC of 0.9999.
Contrarily, attention-based fusion performed poorly (97.08%), despite being an adaptable method of feature combination. This indicates that for this particular dataset of cotton diseases, learning selective interactions between CNN and Transformer features leads to inhibition of some information that would otherwise be helpful for classification. Similarly, weighted prediction fusion and ensemble fusion operate at the decision level rather than the feature representation level. While this makes them more reliable, they fail to explore the interaction between low-level spatial features and high-level contextual features.
The variance-based feature fusion strategy achieved competitive performance (98.83%), demonstrating that reducing redundant feature dimensions can preserve most discriminative information. However, its slightly lower accuracy compared with full feature concatenation suggests that some discarded high-variance-independent features may still contribute useful information for disease discrimination. These findings highlight that feature reduction strategies should carefully balance computational efficiency and information preservation.
Overall, the results have shown that the success of using CNN–Transformer fusion is not only a matter of combining two different neural architectures, but also a matter of retaining complementary feature representation created by these architectures. The results reveal that a simple fusion at the feature level could lead to high performance when the aim is to achieve optimal classification performance, whereas more selective fusion mechanisms may become advantageous when computational constraints are prioritized.

5.2. Explainability Performance and Practical Implications

Quantitative XAI Evaluation shows that various techniques have different localization abilities. Though gradient-based techniques like GradCAM and GradCAM++ are widely used due to their simplicity and fast processing, the results show that EigenCAM is the most precise one for localization among all others for the cotton disease recognition problem. EigenCAM reached the highest values of all scores combined (0.906), as well as of Pointing Game score (0.750), Intersection over Union (IoU) (0.457), Area Under Curve (AUC) (0.806), and Localization Accuracy (0.613).
EigenCAM’s superiority in performance may be attributed to the activation-based approach employed by it since it involves the extraction of the principal component from the feature activations as opposed to the use of gradients for propagation. Hence, EigenCAM will be immune to noise in the gradient and will produce more reliable activation maps, especially when considering images of agriculture where there are changes in background, lighting, and leaves.
However, it should be noted that GradCAM++ and ScoreCAM have shown comparable localization results as well, especially in terms of IoU and AUC scores. The use of such methods is quite beneficial for cases where computational simplicity and compatibility with already trained CNN models are highly desired. Taking into consideration the practical aspect of agriculture, the explanation of the model decision is very important since it provides an opportunity to ensure that the model concentrates on biologically significant symptoms of the disease, rather than other features of the picture.
It is important to note that the quantitative XAI assessment in this work was performed using synthetic reference masks because publicly available pixel-level lesion annotations for the studied cotton leaf dataset were unavailable. Although these masks provide a consistent and uniform evaluation framework, their simplified geometric structure and spatial distribution may introduce evaluation bias and may favor XAI methods whose activation patterns overlap more closely with the constructed reference regions. In particular, they may not adequately represent the irregular lesion boundaries, variable severity levels, and heterogeneous spatial distributions observed in real cotton leaf diseases. Therefore, the resulting XAI rankings, including the superior performance observed for EigenCAM, should be interpreted as preliminary evidence under the present evaluation setting rather than definitive confirmation of real-world disease-localization superiority. Future studies should validate these findings using representative subsets of images with pixel-level lesion masks annotated or verified by agricultural domain experts.

5.3. Accuracy, Computational Cost, and Deployment Considerations

From the findings of the experiments, there is an observable trade-off between the performance of the predictions and computation. The most accurate concatenation fusion method had considerably better prediction accuracy compared to the CNN and Transformer models individually; however, this was attained through an increase in the complexity of computations. Particularly, the dual backbone fusion system utilizes 19.7 GFLOPs, more than 93 million parameters, and takes 552.74 ms for inference per image using the presented CPU configuration. In contrast, the MobileNetV2 takes 40.67 ms and uses 2.23 million parameters. Although the concatenation fusion model improves the classification accuracy from 90.64% for MobileNetV2 to 99.42%, this gain of 8.78 percentage points comes at the cost of approximately 13.6 × higher CPU inference latency and substantially greater model complexity. Therefore, whether this trade-off is justified depends on the deployment scenario: the additional accuracy may be valuable in cloud-based or expert-assisted diagnostic systems where reliability is prioritized, whereas MobileNetV2 or other lightweight alternatives may be more suitable for real-time, resource-constrained field deployment.
Based on the results, it can be stated that the proposed framework is more appropriate to be used in those areas where there is a need to focus more on prediction performance and explainability of the model, such as a cloud-based farming support system or any system that involves disease identification using experts’ help. In contrast, resource-constrained field devices may require lightweight alternatives. For practical deployment on edge devices, future optimization strategies such as knowledge distillation, model pruning, quantization, and lightweight CNN–Transformer architectures could reduce computational requirements while maintaining acceptable diagnostic accuracy.
The use of ImageNet-based transfer learning should also be taken into account when scaling the proposed framework to novel agricultural applications. The benefits of transfer learning are obvious in situations where labeled agricultural data is limited, but the disparity between natural images and plant pathology images could have an impact on generalization. Future research should investigate self-supervised agricultural pre-training strategies and cross-domain adaptation approaches to reduce dependency on generic ImageNet representations.

5.4. Limitations and Future Research Directions

First, the experiments were conducted on a single dataset containing 1711 images, with 171 images reserved for the independent test set. Although stratified splitting and a separate test set were used, the relatively limited dataset size and the high capacity of the dual-backbone fusion model may increase the risk that the reported 99.42% accuracy is influenced by dataset-specific characteristics, including background, illumination, acquisition conditions, or other non-pathological visual cues. In addition, because the publicly available dataset does not provide plant-level or acquisition-session identifiers, complete separation of potentially correlated images across the subsets could not be verified, and the possibility of near-duplicate images cannot be completely excluded. Therefore, the current results should be interpreted as strong performance on the studied dataset rather than definitive evidence of broad real-world generalization. Future studies should validate the proposed framework using larger and independently collected datasets, stratified cross-validation, multiple geographical regions, and acquisition settings with appropriate plant-level or session-level separation.
Second, the proposed dual-backbone system is more computationally expensive than lightweight CNN systems. Even though the added complexity yields better classification accuracy and feature representation, future research should focus on developing more efficient hybrid architectures suitable for real-time field deployment.
Third, the present model considers only visual disease classification. In real agricultural fields, there are many different factors that contribute to the onset of diseases, which include climatic conditions, soil types, and the passage of time. Integrating visual information with environmental and temporal data may enable more comprehensive disease monitoring and early risk prediction systems.
Fourth, the investigated backbone models rely on ImageNet-pretrained weights through transfer learning. Although this initialization facilitates effective learning from the relatively limited cotton disease dataset, the learned representations originate from a natural-image domain and may not fully capture crop- and disease-specific characteristics. Consequently, the performance and adaptation efficiency of the proposed framework may depend on the compatibility between the source-domain representations and the target agricultural domain. Future research should therefore investigate domain-specific pretraining, self-supervised learning on large-scale agricultural imagery, and training strategies that reduce dependence on generic ImageNet representations.
Finally, although the presented XAI analysis provides quantitative evidence for comparing explanation methods, validation with expert-provided lesion annotations remains an important future direction. Furthermore, the applicability of the proposed framework to other crop species has not been experimentally validated in the present study. Differences in leaf morphology, disease appearance, imaging conditions, and symptom characteristics across crops may affect both classification performance and the behavior of the XAI methods. Therefore, evaluation on diverse crop species and disease datasets is necessary to determine whether the observed performance and explainability characteristics generalize beyond cotton.

6. Conclusions

In this study, we presented a systematic empirical framework for evaluating CNN–Transformer fusion and explainability strategies for cotton leaf disease classification. Rather than proposing a fundamentally new CNN, Transformer, fusion mechanism, or XAI algorithm, the primary contribution of this work is the controlled comparison of established approaches under a unified experimental protocol. By keeping the backbone models fixed while evaluating multiple fusion strategies, computational characteristics, and XAI methods, the study provides empirical evidence regarding the relative effectiveness, efficiency, and explainability of these approaches for agricultural disease classification.
Through extensive experimentation on the Kaggle cotton leaf disease dataset, we demonstrated several key findings. First, among individual architectures, ViT-Base achieved superior performance ( 96.49 % accuracy) compared to the best CNN model, DenseNet121 ( 92.40 % ), highlighting the advantage of global contextual modeling for plant disease recognition. However, CNN architectures remain valuable for capturing fine-grained local disease characteristics, with EfficientNet-B0 demonstrating an excellent trade-off between accuracy ( 91.81 % ) and computational efficiency ( 57.13 ms inference time, 15.47 MB model size).
Second, our systematic evaluation of five fusion strategies revealed that simple feature concatenation of CNN and transformer representations achieved the highest classification performance ( 99.42 % accuracy, 95% CI: 98.2 100 % , MCC = 0.9922 ) and outperformed all standalone models. The concatenation strategy’s effectiveness can be attributed to its ability to preserve the full representational capacity of both architectures without imposing restrictive assumptions about feature interactions. The proposed variance-based fusion method, which retains only the top 30 % most variable features, achieved an accuracy of 98.83 % . This means it is possible to eliminate redundant features through the XAI process without sacrificing discriminative power.
Third, our extensive computational analysis showed that there are certain trade-offs involved when deploying in real life. Although fusion models offer better performance in terms of accuracy, they also come with a huge amount of computational cost (around 19.7 GFLOPs, >92M parameters, and 500–558 ms inference time) compared to lightweight CNN models such as MobileNetV2 (326 MFLOPs, 2.23 M parameters, 40.67 ms). These results offer practical insights into choosing the right architecture given the deployment restrictions, from resource-limited edge devices to high performance cloud-based inference solutions.
Fourth, using one of the first benchmarking efforts on XAI approaches for cotton leaf disease detection, we show that EigenCAM consistently outperforms gradient approaches on all considered metrics (Pointing Game: 0.750 , IoU: 0.457 , AUC: 0.806 , Localization Accuracy: 0.613 ). This finding has important implications for the selection of explanation methods in precision agriculture, where the reliability of visual explanations directly impacts stakeholder trust and adoption.
The practical implications of our findings extend beyond cotton disease detection. The proposed framework’s dual-backbone architecture and rigorous evaluation methodology can be readily adapted to other agricultural disease diagnosis tasks, crop monitoring systems, and plant phenotyping applications where both local lesion characteristics and global contextual information are essential for accurate diagnosis. The quantitative XAI benchmarking framework provides a reproducible methodology for evaluating explanation quality across different tasks and datasets, addressing a critical gap in the agricultural AI literature.
Despite the promising results, several limitations need to be acknowledged. The dataset, while representative of real-field conditions with variations in illumination, background, and disease severity, is relatively modest in size (1711 images). Although we employed data augmentation and TL to mitigate overfitting, the framework’s generalization to larger and more diverse datasets, multiple growing seasons, and geographical regions remains to be validated. Moreover, the artificial ground-truth masks employed to assess the XAI models could potentially lack sufficient consideration of the irregular nature of the lesions caused by natural infections. The use of experts’ annotations of disease regions at the pixel level would be recommended in future research on validating the XAI benchmarking outcomes.
Future research will focus on extending the framework toward multi-temporal disease progression analysis and multi-class severity grading, while developing lightweight hybrid model variants optimized for real-time and edge deployment through knowledge distillation, network quantization, and efficient feature fusion. We also plan to investigate multimodal agricultural intelligence by integrating visual features with local meteorological, soil, and temporal information for more comprehensive and proactive disease risk assessment. In addition, the proposed framework and XAI benchmarking methodology will be evaluated across diverse cotton datasets and extended to other crop and plant disease classification tasks to assess its cross-crop generalization. Structurally, adaptive fusion mechanisms, including dynamic routing and mixture-of-experts architectures, will be explored to improve the balance between predictive performance and computational efficiency. Finally, user studies with agricultural experts will be conducted to evaluate the practical utility, interpretability, and trustworthiness of the generated explanations under realistic field conditions.

Author Contributions

Conceptualization, N.U., I.D.F. and G.S.; methodology, N.U.; software, N.U.; validation, N.U., I.D.F. and G.S.; formal analysis, N.U., I.D.F. and G.S.; investigation, N.U., I.D.F. and G.S.; data curation, N.U.; writing—original draft preparation, N.U.; writing—review and editing, N.U., I.D.F. and G.S.; supervision, I.D.F. and G.S. All authors have read and agreed to the published version of the manuscript.

Funding

This research received no external funding.

Institutional Review Board Statement

Not applicable.

Informed Consent Statement

Not applicable.

Data Availability Statement

The dataset analyzed in this study, the Cotton Leaf Disease dataset, is publicly available on Kaggle (https://www.kaggle.com/datasets/seroshkarim/cotton-leaf-disease-dataset (accessed on 8 February 2026)). Instead, the source code used in this study is available at https://github.com/Engr-Naeem-Ullah/Optimizing-Deep-Learning-with-Meta-Heuristic-Feature-Selection-Algorithms (accessed on 01 March 2026)).

Acknowledgments

This article is a revised and expanded version of a paper entitled “Optimizing Deep Learning for Cotton Leaf Disease Detection Using Meta-Heuristic Feature Selection Algorithms”, which was presented at the 20th Conference on Computer Science and Intelligence Systems (FedCSIS), Kraków, Poland, 14–17 September 2025 [9].

Conflicts of Interest

The authors declare no conflicts of interest.

References

  1. Khan, M.A.; Wahid, A.; Ahmad, M.; Tahir, M.T.; Ahmed, M.; Ahmad, S.; Hasanuzzaman, M. World cotton production and consumption: An overview. In Cotton Production and Uses: Agronomy, Crop Protection, and Postharvest Technologies; Springer: Singapore, 2020; pp. 1–7. [Google Scholar]
  2. Chohan, S.; Perveen, R.; Abid, M.; Tahir, M.N.; Sajid, M. Cotton diseases and their management. In Cotton Production and Uses: Agronomy, Crop Protection, and Postharvest Technologies; Springer: Singapore, 2020; pp. 239–270. [Google Scholar]
  3. Yang, Z.Y.; Xia, W.K.; Chu, H.Q.; Su, W.H.; Wang, R.F.; Wang, H. A comprehensive review of deep learning applications in cotton industry: From field monitoring to smart processing. Plants 2025, 14, 1481. [Google Scholar] [CrossRef] [Scilit] [PubMed]
  4. Ullah, N.; Ruocco, M.; Della Cioppa, A.; De Falco, I.; Sannino, G. An explainable deep learning framework with adaptive feature selection for smart lemon disease classification in agriculture. Electronics 2025, 14, 3928. [Google Scholar] [CrossRef] [Scilit]
  5. Yang, X.; Li, L.; Xue, S.; Li, S.; Yang, W.; Tang, H.; Huang, X. MRFP-Mamba: Multi-Receptive Field Parallel Mamba for Hyperspectral Image Classification. Remote Sens. 2025, 17, 2208. [Google Scholar] [CrossRef] [Scilit]
  6. Khan, A.; Rauf, Z.; Sohail, A.; Khan, A.R.; Asif, H.; Asif, A.; Farooq, U. A survey of the vision transformers and their CNN-transformer based variants. Artif. Intell. Rev. 2023, 56, 2917–2970. [Google Scholar] [CrossRef] [Scilit]
  7. Ullah, N.; Khan, J.A.; De Falco, I.; Sannino, G. Explainable artificial intelligence: Importance, use domains, stages, output shapes, and challenges. ACM Comput. Surv. 2024, 57, 94. [Google Scholar] [CrossRef] [Scilit]
  8. Ullah, N.; Khan, J.A.; Ruocco, M.; Cioppa, A.D.; De Falco, I.; Sannino, G. Addressing Background Bias in Explainable Orange Fruit Disease Classification Using Deep Learning. Comput. Mater. Contin. 2026, 88, 84. [Google Scholar] [CrossRef] [Scilit]
  9. Ullah, N.; Martínez-Álvarez, F.; De Falco, I.; Sannino, G. Optimizing Deep Learning for Cotton Leaf Disease Detection Using Meta-Heuristic Feature Selection Algorithms. In Proceedings of the 2025 20th Conference on Computer Science and Intelligence Systems (FedCSIS); IEEE: New York, NY, USA, 2025; pp. 605–614. [Google Scholar]
  10. He, K.; Zhang, X.; Ren, S.; Sun, J. Deep residual learning for image recognition. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition; IEEE: New York, NY, USA, 2016; pp. 770–778. [Google Scholar]
  11. Tan, M.; Le, Q. Efficientnet: Rethinking model scaling for convolutional neural networks. In Proceedings of the International Conference on Machine Learning, PMLR; Journal of Machine Learning Research Inc.: New York, NY, USA, 2019; pp. 6105–6114. [Google Scholar]
  12. Huang, G.; Liu, Z.; Van Der Maaten, L.; Weinberger, K.Q. Densely connected convolutional networks. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition; IEEE: New York, NY, USA, 2017; pp. 4700–4708. [Google Scholar]
  13. Sandler, M.; Howard, A.; Zhu, M.; Zhmoginov, A.; Chen, L.C. Mobilenetv2: Inverted residuals and linear bottlenecks. In Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition; IEEE: New York, NY, USA, 2018; pp. 4510–4520. [Google Scholar]
  14. Islam, K. Recent advances in vision transformer: A survey and outlook of recent work. arXiv 2022, arXiv:2203.01536. [Google Scholar]
  15. Wei, S.; Ye, T.; Zhang, S.; Tang, Y.; Liang, J. Joint token pruning and squeezing towards more aggressive compression of vision transformers. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition; IEEE: New York, NY, USA, 2023; pp. 2092–2101. [Google Scholar]
  16. Guo, W.; Xu, G.; Wang, Y. Horizontal and vertical features fusion network based on different brain regions for emotion recognition. Knowl.-Based Syst. 2022, 247, 108819. [Google Scholar] [CrossRef] [Scilit]
  17. Dai, Y.; Gieseke, F.; Oehmcke, S.; Wu, Y.; Barnard, K. Attentional feature fusion. In Proceedings of the IEEE/CVF Winter Conference on Applications of Computer Vision; IEEE: New York, NY, USA, 2021; pp. 3560–3569. [Google Scholar]
  18. Zhang, Y.; Huynh, C.P.; Ngan, K.N. Feature fusion with predictive weighting for spectral image classification and segmentation. IEEE Trans. Geosci. Remote Sens. 2019, 57, 6792–6807. [Google Scholar] [CrossRef]
  19. Xia, W.; Han, D.; Li, D.; Wu, Z.; Han, B.; Wang, J. An ensemble learning integration of multiple CNN with improved vision transformer models for pest classification. Ann. Appl. Biol. 2023, 182, 144–158. [Google Scholar] [CrossRef] [Scilit]
  20. Selvaraju, R.R.; Cogswell, M.; Das, A.; Vedantam, R.; Parikh, D.; Batra, D. Grad-CAM: Visual explanations from deep networks via gradient-based localization. Int. J. Comput. Vis. 2020, 128, 336–359. [Google Scholar] [CrossRef] [Scilit]
  21. Jamil, M.S.; Banik, S.P.; Rahaman, G.A.; Saha, S. Advanced gradcam++: Improved visual explanations of CNN decisions in diabetic retinopathy. In Computer Vision and Image Analysis for Industry 4.0; Chapman and Hall/CRC: Boca Raton, FL, USA, 2023; pp. 64–75. [Google Scholar]
  22. Wang, H.; Wang, Z.; Du, M.; Yang, F.; Zhang, Z.; Ding, S.; Mardziel, P.; Hu, X. Score-CAM: Score-weighted visual explanations for convolutional neural networks. In Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition Workshops; IEEE: New York, NY, USA, 2020; pp. 24–25. [Google Scholar]
  23. Jiang, P.T.; Zhang, C.B.; Hou, Q.; Cheng, M.M.; Wei, Y. Layercam: Exploring hierarchical class activation maps for localization. IEEE Trans. Image Process. 2021, 30, 5875–5888. [Google Scholar] [CrossRef] [Scilit] [PubMed]
  24. Muhammad, M.B.; Yeasin, M. Eigen-cam: Class activation map using principal components. In Proceedings of the 2020 International Joint Conference on Neural Networks (IJCNN); IEEE: New York, NY, USA, 2020; pp. 1–7. [Google Scholar]
  25. Desai, S.; Ramaswamy, H.G. Ablation-cam: Visual explanations for deep convolutional network via gradient-free localization. In Proceedings of the IEEE/CVF Winter Conference on Applications of Computer Vision; IEEE: New York, NY, USA, 2020; pp. 983–991. [Google Scholar]
  26. Caldeira, R.F.; Santiago, W.E.; Teruel, B. Identification of cotton leaf lesions using deep learning techniques. Sensors 2021, 21, 3169. [Google Scholar] [CrossRef] [Scilit] [PubMed]
  27. Memon, M.S.; Kumar, P.; Iqbal, R. Meta deep learn leaf disease identification model for cotton crop. Computers 2022, 11, 102. [Google Scholar] [CrossRef] [Scilit]
  28. Latif, M.R.; Khan, M.A.; Javed, M.Y.; Masood, H.; Tariq, U.; Nam, Y.; Kadry, S. Cotton leaf diseases recognition using deep learning and genetic algorithm. Comput. Mater. Contin. 2021, 69, 2917–2932. [Google Scholar] [CrossRef] [Scilit]
  29. Bishshash, P.; Nirob, A.S.; Shikder, H.; Sarower, A.H.; Bhuiyan, T.; Noori, S.R.H. A comprehensive cotton leaf disease dataset for enhanced detection and classification. Data Brief 2024, 57, 110913. [Google Scholar] [CrossRef] [Scilit] [PubMed]
  30. Azath, M.; Zekiwos, M.; Bruck, A. Deep Learning-Based Image Processing for Cotton Leaf Disease and Pest Diagnosis. J. Electr. Comput. Eng. 2021, 2021, 9981437. [Google Scholar] [CrossRef] [Scilit]
  31. Haque, M.E.; Saykat, M.T.H.; Al-Imran, M.; Siam, A.H.; Uddin, J.; Ghose, D. An attention enhanced CNN ensemble for interpretable and accurate cotton leaf disease classification. Sci. Rep. 2026, 16, 4476. [Google Scholar] [CrossRef] [Scilit] [PubMed]
  32. Kaur, G.; Al-Yarimi, F.A.M.; Bharany, S.; Rehman, A.U.; Hussen, S. Explainable AI for Cotton Leaf Disease Classification: A Metaheuristic-Optimized Deep Learning Approach. Food Sci. Nutr. 2025, 13, e70658. [Google Scholar] [CrossRef] [Scilit] [PubMed]
  33. Inamdar, N.; Managuli, M.; Koti, R.; Jakati, J.; P.H., S.; Kulkarni, P. Precision cotton disease detection via transformer models applied to leaf imagery. Front. Artif. Intell. 2025, 8, 1743264. [Google Scholar] [CrossRef] [Scilit] [PubMed]
  34. Ahmad, M.; Ullah, F.; Hamza, A.R.A.; Usman, M.; Imran, M.; Batyrshin, I.; Gelbukh, A.; Sidorov, G. Cotton leaf disease detection using vision transformers: A deep learning approach. Afr. J. Biomed. Res. 2024, 27, 5760–5769. [Google Scholar] [CrossRef] [Scilit]
  35. Mondal, A.; Chatterjee, A.; Avazov, N. A hybrid CNN-transformer model with adaptive activation function for potato leaf disease classification. Sci. Rep. 2026, 16, 4282. [Google Scholar] [CrossRef] [Scilit] [PubMed]
  36. Jawed, M.M.; Tufail, F.A.; Ahmed, M.Z.; R, A.S.; Nallusamy, P.; Raja, K.T. A hybrid deep learning framework using convolutional and transformer models for robust plant disease classification. Sci. Rep. 2026, 16, 9704. [Google Scholar] [CrossRef] [Scilit] [PubMed]
  37. Jia, S.; Wang, G.; Li, H.; Liu, Y.; Shi, L.; Yang, S. ConvTransNet-S: A CNN-Transformer hybrid disease recognition model for complex field environments. Plants 2025, 14, 2252. [Google Scholar] [CrossRef] [Scilit] [PubMed]
  38. Dhruw, L.K.; Tewari, V.K.; Soni, P.; Chouriya, A.; Patidar, P.; Singh, N. Development of a unified deep learning approach integrating CNN-based local and ViT-based global feature extraction for enhanced cotton disease and pest classification. Plant Methods 2025, 21, 142. [Google Scholar] [CrossRef] [Scilit] [PubMed]
  39. Biju, G.; Khan, A.; Walker, D.; Qadri, S.; Hssan, Q.; Mahmood, K.; Hanan, A. Identification of Cotton Leaf Curl Disease Using CNN and Vision Transformer. In Proceedings of the SAI Intelligent Systems Conference; Springer: Cham, Switzerland, 2023; pp. 670–688. [Google Scholar]
  40. Srinivasan, S.; A, R.K.; B. A, N.; Tanwar, J.; Singh, V.P.; Moorthy, U. Multi-class classification of plant leaf diseases using a hybrid deep neural transformer system and explainable AI techniques. Sci. Rep. 2026, 16, 18161. [Google Scholar] [CrossRef] [Scilit] [PubMed]
  41. Swapno, S.M.R.; Sakib, A.; Pranta, A.S.U.K.; Hossain, A.; Debnath, J.; Al Noman, A.; Al Sakib, A.; Ahmed, M.R.; Haque, R.; Appaji, A.; et al. Explainable transformer framework for fast cotton leaf diagnostics and fabric defect detection. iScience 2026, 29, 114411. [Google Scholar] [CrossRef] [Scilit] [PubMed]
  42. Malik, V.; AlJarullah, A.; Alsubait, T.; Ikram, A.; Goyal, S.B.; Khan, M. Explainable artificial-intelligence-based hyperspectral image analysis for leaf disease detection in intercropping system. Front. Plant Sci. 2026, 17, 1789542. [Google Scholar] [CrossRef] [Scilit] [PubMed]
  43. Askr, H.; El-dosuky, M.; Darwish, A.; Hassanien, A.E. Explainable ResNet50 learning model based on copula entropy for cotton plant disease prediction. Appl. Soft Comput. 2024, 164, 112009. [Google Scholar] [CrossRef] [Scilit]
  44. Monisha, R.; Tamilselvan, K.; Sharmila, A. Advancing plant disease detection with hybrid models: Vision transformer and CNN-based approaches. In Computational Intelligence in Internet of Agricultural Things; Springer: Cham, Switzerland, 2024; pp. 275–307. [Google Scholar]
  45. Amin, J.; Anjum, M.A.; Sharif, M.; Kadry, S.; Kim, J. Explainable neural network for classification of cotton leaf diseases. Agriculture 2022, 12, 2029. [Google Scholar] [CrossRef] [Scilit]
  46. Taud, H.; Mas, J.F. Multilayer perceptron (MLP). In Geomatic Approaches for Modeling Land Change Scenarios; Springer: Cham, Switzerland, 2017; pp. 451–455. [Google Scholar]
  47. Paszke, A.; Gross, S.; Massa, F.; Lerer, A.; Bradbury, J.; Chanan, G.; Killeen, T.; Lin, Z.; Gimelshein, N.; Antiga, L.; et al. PyTorch: An Imperative Style, High-Performance Deep Learning Library. arXiv 2019. [Google Scholar] [CrossRef] [Scilit]
Figure 1. Workflow of the proposed framework for cotton disease classification and XAI benchmarking. The color-coded panels distinguish the different stages and fusion strategies of the workflow, while the arrows indicate the direction of information flow and processing.
Figure 1. Workflow of the proposed framework for cotton disease classification and XAI benchmarking. The color-coded panels distinguish the different stages and fusion strategies of the workflow, while the arrows indicate the direction of information flow and processing.
Electronics 15 03650 g001
Figure 2. Representative samples from the dataset. Red arrows indicate the locations of disease symptoms on the leaves.
Figure 2. Representative samples from the dataset. Red arrows indicate the locations of disease symptoms on the leaves.
Electronics 15 03650 g002
Figure 3. Qualitative comparison of six XAI methods for cotton leaf disease classification. Each row shows a test sample (true label: bacterial blight) with its original image and heatmaps from GradCAM, GradCAM++, ScoreCAM, LayerCAM, EigenCAM, and AblationCAM. Red/yellow indicates high attention, blue indicates low attention. Notably, GradCAM, GradCAM++, ScoreCAM, LayerCAM, and AblationCAM exhibit activations spilling into the background outside the leaf, whereas EigenCAM demonstrates strict localization confined to the leaf surface, effectively suppressing background noise.
Figure 3. Qualitative comparison of six XAI methods for cotton leaf disease classification. Each row shows a test sample (true label: bacterial blight) with its original image and heatmaps from GradCAM, GradCAM++, ScoreCAM, LayerCAM, EigenCAM, and AblationCAM. Red/yellow indicates high attention, blue indicates low attention. Notably, GradCAM, GradCAM++, ScoreCAM, LayerCAM, and AblationCAM exhibit activations spilling into the background outside the leaf, whereas EigenCAM demonstrates strict localization confined to the leaf surface, effectively suppressing background noise.
Electronics 15 03650 g003
Table 1. Comparison of existing cotton leaf disease classification studies and the proposed framework.
Table 1. Comparison of existing cotton leaf disease classification studies and the proposed framework.
Ref.MethodCNNTransformerHybridFeature Selection/
Optimization
XAIQuantitative XAIAccuracy (%)
 [26]GoogleNet, ResNet50×××××89.20
[27]Meta Deep Learning Framework××Meta Learning××98.53
[29]InceptionV3×××××96.03
[28]ResNet101 + GA + SVM××××98.80
[30]CNN + K-fold Validation×××××96.40
[37]ConvTransNet-S×××98.85
[34]Vision Transformer (ViT)×××××96.72
[40]ResViT-152××99.23
[38]CNN-ViT Hybrid×××98.50
[33]ViT, Swin, DeiT, T2T-ViT×××××99.99
[44]Review of Hybrid CNN-ViT ModelsConceptual×××
[39]ConViT Hybrid Architecture×××85.00
[45]VGG16-based Framework×××××99.99
[43]ResNet50 + CE-GWO + RF×××99.00
[32]EfficientNetB3 + InceptionResNetV2×Hybrid CNN××98.00
[41]XCottL-FebViT××99.93
[31]CottonLeafNet Ensemble×Ensemble××99.43
[35]PLDNet (DenseNet + Transformer Attention)×××99.54
[36]EfficientNet-B7 + ViT-B16 Hybrid×××98.13
[4]PSO-LemonNetX + LIME××PSO-based Feature Selection×97.01
[42]Transformer + EGPO + CSSNet××EGPO-based Feature Selection
[8]DeepOrangeNet + LIME××Grid SearchQuantitative Background Attribution Analysis98.45
ProposedMulti-Fusion CNN–Transformer Framework (DenseNet121 + ViT-Base)Variance-Based Fusion99.42 (concatenation fusion) and 98.83 (variance-based fusion)
✓ = Feature/capability present; × = Feature/capability not present.
Table 2. Distribution of images in the cotton leaf disease dataset.
Table 2. Distribution of images in the cotton leaf disease dataset.
ClassNumber of Images
Curl virus418
Bacterial blight448
Fusarium wilt419
Healthy426
Total1711
Table 3. Number of images in the training, validation, and test subsets.
Table 3. Number of images in the training, validation, and test subsets.
ClassTraining (72%)Validation (18%)Test (10%)Total
Curl virus3017542418
Bacterial blight3228145448
Fusarium wilt3027542419
Healthy3077742426
Total12323081711711
Table 4. System specifications.
Table 4. System specifications.
ComponentSpecification
CPUIntel® CoreTM i5-5200U
GPUNone (CPU-only implementation)
RAM8 GB
Storage500 GB HDD + 232 GB SSD
Operating SystemWindows 10 (64-bit)
Deep Learning FrameworkPyTorch
Table 5. Hyperparameter configuration.
Table 5. Hyperparameter configuration.
ParameterValue
Image Size 224 × 224 pixels
Batch Size8
Learning Rate 1 × 10 4
Weight Decay 1 × 10 5
OptimizerAdamW
LR SchedulerReduceLROnPlateau (factor = 0.5, patience = 2)
Early Stopping Patience3 epochs
Epochs (Individual Models)12
Epochs (Fusion Models)15
Table 6. Summary of evaluation metrics used for classification performance, computational efficiency, and feature selection.
Table 6. Summary of evaluation metrics used for classification performance, computational efficiency, and feature selection.
MetricDescriptionFormula/Units
Classification Performance
AccuracyProportion of correct predictions T P + T N T P + T N + F P + F N
Balanced AccuracyAverage recall per class 1 C i = 1 C T P i T P i + F N i
Precision (macro/weighted)Weighted average of precision per class 1 C i = 1 C T P i T P i + F P i
Recall (macro/weighted)Weighted average of recall per class 1 C i = 1 C T P i T P i + F N i
F1-Score (macro/weighted)Harmonic mean of precision and recall 2 · Precision · Recall Precision + Recall
Cohen’s KappaAgreement between predictions and ground truth p o p e 1 p e
MCCCorrelation coefficient for multi-class T P · T N F P · F N ( T P + F P ) ( T P + F N ) ( T N + F P ) ( T N + F N )
AUC (macro/weighted)Area under the ROC curve 0 1 TPR ( FPR ) d FPR
95% Bootstrap CIConfidence interval for accuracyPercentile bootstrap (500 resamples)
Computational Efficiency
FLOPsFloating-point operations per forward passGiga/Mega FLOPs (GFLOPs/MFLOPs)
ParametersNumber of trainable weightsMillion/Thousand (M/K)
Inference TimeTime to process one imageMilliseconds (ms)
Model SizeDisk space occupied by modelMegabytes (MB)
Explainability (XAI) Metrics
Pointing GameAccuracy of the max heatmap point within the ground-truth mask hit total
Intersection over Union (IoU)Overlap between binarised heatmap and mask | H M | | H M |
AUC (heatmap vs. mask)ROC AUC between heatmap intensities and binary mask 0 1 TPR ( FPR ) d FPR
Localization AccuracyCoverage of top-20% heatmap regions inside mask H top 20 · M M
Table 7. Classification performance of individual deep learning models. Performance metrics include Accuracy (Acc.), 95% Confidence Interval lower bound (CI L), 95% Confidence Interval upper bound (CI H), Balanced Accuracy (Bal.), Macro Precision (P(M)), Weighted Precision (P(W)), Macro Recall (R(M)), Weighted Recall (R(W)), Macro F1-score (F1(M)), Weighted F1-score (F1(W)), Cohen’s Kappa ( κ ), Matthews Correlation Coefficient (MCC), Macro Area Under the Receiver Operating Characteristic Curve (AUC(M)), and Weighted Area Under the Receiver Operating Characteristic Curve (AUC(W)).
Table 7. Classification performance of individual deep learning models. Performance metrics include Accuracy (Acc.), 95% Confidence Interval lower bound (CI L), 95% Confidence Interval upper bound (CI H), Balanced Accuracy (Bal.), Macro Precision (P(M)), Weighted Precision (P(W)), Macro Recall (R(M)), Weighted Recall (R(W)), Macro F1-score (F1(M)), Weighted F1-score (F1(W)), Cohen’s Kappa ( κ ), Matthews Correlation Coefficient (MCC), Macro Area Under the Receiver Operating Characteristic Curve (AUC(M)), and Weighted Area Under the Receiver Operating Characteristic Curve (AUC(W)).
ModelAcc.CI LCI HBal.P(M)P(W)R(M)R(W)F1(M)F1(W)KappaMCCAUC(M)AUC(W)
CNN-ResNet5085.9681.391.285.870.86590.86480.85870.85960.85900.85890.81270.81470.96730.9671
CNN-EfficientNet-B091.8187.795.391.750.91790.91820.91750.91810.91760.91810.89080.89080.98750.9876
CNN-DenseNet12192.4088.396.292.340.92620.92640.92340.92400.92370.92410.89860.89930.98580.9859
CNN-MobileNetV290.0685.494.790.040.90160.90170.90040.90060.89970.89990.86740.86820.98150.9814
Transformer-ViT-Base96.4993.098.896.430.96480.96500.96430.96490.96420.96460.95320.95340.99940.9995
Transformer-DeiT-Small87.1382.191.887.100.88850.88810.87100.87130.87310.87320.82840.83280.98180.9819
Table 8. Computational complexity analysis of individual deep learning models.
Table 8. Computational complexity analysis of individual deep learning models.
ModelFLOPsParametersInference Time (ms)Model Size (MB)
CNN-ResNet504.132 G23.516 M140.3389.91
CNN-EfficientNet-B0413.870 M4.013 M57.1315.47
CNN-DenseNet1212.896 G6.958 M149.6726.86
CNN-MobileNetV2326.212 M2.229 M40.678.63
Transformer-ViT-Base16.848 G85.611 M346.87327.31
Transformer-DeiT-Small4.241 G21.572 M106.0782.66
Table 9. Classification performance of the proposed fusion strategies. Performance metrics include Accuracy (Acc.), 95% Confidence Interval lower bound (CI L), 95% Confidence Interval upper bound (CI H), Balanced Accuracy (Bal.), Macro Precision (P(M)), Weighted Precision (P(W)), Macro Recall (R(M)), Weighted Recall (R(W)), Macro F1-score (F1(M)), Weighted F1-score (F1(W)), Cohen’s Kappa ( κ ), Matthews Correlation Coefficient (MCC), Macro Area Under the Receiver Operating Characteristic Curve (AUC(M)), and Weighted Area Under the Receiver Operating Characteristic Curve (AUC(W)).
Table 9. Classification performance of the proposed fusion strategies. Performance metrics include Accuracy (Acc.), 95% Confidence Interval lower bound (CI L), 95% Confidence Interval upper bound (CI H), Balanced Accuracy (Bal.), Macro Precision (P(M)), Weighted Precision (P(W)), Macro Recall (R(M)), Weighted Recall (R(W)), Macro F1-score (F1(M)), Weighted F1-score (F1(W)), Cohen’s Kappa ( κ ), Matthews Correlation Coefficient (MCC), Macro Area Under the Receiver Operating Characteristic Curve (AUC(M)), and Weighted Area Under the Receiver Operating Characteristic Curve (AUC(W)).
Fusion ApproachAcc.CI LCI HBal.P(M)P(W)R(M)R(W)F1(M)F1(W) κ MCCAUC(M)AUC(W)
Concatenation Fusion99.4298.210099.400.99420.99430.99400.99420.99400.99420.99220.99220.99990.9999
Attention Fusion97.0894.799.497.100.97170.97220.97100.97080.97090.97100.96100.96130.99960.9996
Weighted Fusion95.3291.898.295.280.95310.95320.95280.95320.95280.95310.93760.93770.99790.9980
Ensemble Fusion97.6695.399.497.660.97700.97740.97660.97660.97650.97670.96880.96900.99980.9998
variance-based fusion98.8397.110098.810.98840.98860.98810.98830.98800.98820.98440.98450.99970.9997
Table 10. Computational complexity analysis of the proposed fusion models.
Table 10. Computational complexity analysis of the proposed fusion models.
Fusion ApproachFLOPsParametersInference Time (ms)Model Size (MB)
Concatenation Fusion19.745 G93.612 M552.74358.18
Attention Fusion19.744 G93.055 M516.54357.06
Weighted Fusion19.744 G92.569 M503.00354.20
Ensemble Fusion19.744 G92.569 M500.81354.17
variance-based fusion19.744 G92.733 M557.74354.83
Table 11. Average quantitative metrics for six XAI methods across all test samples. Bold values indicate the best performance for each metric.
Table 11. Average quantitative metrics for six XAI methods across all test samples. Bold values indicate the best performance for each metric.
MethodPointing GameIoUAUCLocalization Accuracy
GradCAM0.5830.3300.6740.336
GradCAM++0.5000.4510.7420.413
ScoreCAM0.4170.4350.7500.413
LayerCAM0.4170.4330.7480.441
EigenCAM0.7500.4570.8060.613
AblationCAM0.5000.3220.6380.301
Table 12. Ranking of XAI methods based on combined performance across all four metrics. The combined score is computed as the average of normalized metric values.
Table 12. Ranking of XAI methods based on combined performance across all four metrics. The combined score is computed as the average of normalized metric values.
RankMethodCombined Score
1EigenCAM0.906
2GradCAM++0.707
3ScoreCAM0.700
4LayerCAM0.695
5GradCAM0.682
6AblationCAM0.564
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.

Share and Cite

MDPI and ACS Style

Ullah, N.; De Falco, I.; Sannino, G. Cotton Leaf Disease Detection via Dual-Backbone CNN-Transformer Fusion with Quantitative XAI Comparison. Electronics 2026, 15, 3650. https://doi.org/10.3390/electronics15163650

AMA Style

Ullah N, De Falco I, Sannino G. Cotton Leaf Disease Detection via Dual-Backbone CNN-Transformer Fusion with Quantitative XAI Comparison. Electronics. 2026; 15(16):3650. https://doi.org/10.3390/electronics15163650

Chicago/Turabian Style

Ullah, Naeem, Ivanoe De Falco, and Giovanna Sannino. 2026. "Cotton Leaf Disease Detection via Dual-Backbone CNN-Transformer Fusion with Quantitative XAI Comparison" Electronics 15, no. 16: 3650. https://doi.org/10.3390/electronics15163650

APA Style

Ullah, N., De Falco, I., & Sannino, G. (2026). Cotton Leaf Disease Detection via Dual-Backbone CNN-Transformer Fusion with Quantitative XAI Comparison. Electronics, 15(16), 3650. https://doi.org/10.3390/electronics15163650

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop