Organizations: Department of Artificial Intelligence, Sardar Vallabhbhai National Institute of Technology, Surat, Gujarat, India. · Electrical and Computer Engineering Department, State University of New York Polytechnic Institute, Utica, New York, USA. · Department of Information Security and Communication Technology, Norwegian University of Science and Technology, Gjovik, Norway.
In recent years, automated fruit classification systems have become a more critical component in precision agriculture for efficient yield estimation, quality control, and supply chain optimization. However, they still face significant challenges under varying quality, fruit maturity, illumination, texture degradation, morphological attributes, domain shift, and post-harvest handling conditions. In this study, we address the challenging issue of cross-grade banana variety classification. This is a real-world setting where models that have been trained on specific quality grades must generalize to unseen grades to handle significant domain shift. Under a rigorous Leave-One-Grade-Out evaluation protocol, we present a thorough comparative analysis of CNNs, ViTs, and dual-stream hybrid architectures using a large-scale dataset of 31,678 banana images with three varieties and three quality grades. Specifically, to address the drawbacks of single-paradigm frameworks, we present a dual-stream Swin ResNet hybrid framework enhanced with KL-divergence-based self-distillation to align probabilistic feature representations across the CNN and Transformer streams. Comprehensive experimental analyzes show that the presented hybrid framework with KL-divergence based self-distillation achieves better overall performance, i.e., it attains a mean accuracy of 81.25% and significantly surpasses CNN and Transformer baseline models. Qualitative analysis further confirms that the hybrid framework in this study improves discriminative feature transferability, improves attention localization, and stabilizes optimization.
Figures & tables
Variety
Count
Percentage
Pachbale
11,512
36.34%
Rasbale
10,112
31.92%
Elakki-bale
10,054
31.74%
Total
31,678
100.00%
Table 1: Overall Dataset Statistics.
Grade
Variety
Count
Percentage
Grade Total
Grade 1 (Heavily blemished)
Pachbale
3,807
36.56%
10,412
Rasbale
3,589
34.47%
Elakki-bale
3,016
28.97%
Grade 2 (Moderate defects)
Pachbale
3,944
36.42%
10,830
Elakki-bale
3,571
32.97%
Rasbale
3,315
30.61%
Table 2: Variety Distribution Across Quality Grades
Figure 1: Illustration of the KL Divergence-based distillation mechanism used to align feature distributions.
Experiment
Training Grades
Test Grade
Train Size
Test Size
1
Grade 2 + Grade 3
Grade 1
19,139
10,412
2
Grade 1 + Grade 3
Grade 2
18,763
10,830
3
Grade 1 + Grade 2
Grade 3
19,117
10,436
Table 3: Experimental Configuration for Leave-One-Grade-Out (LOGO) Cross-Validation
Model
Mean Acc.
Std Acc.
Mean F1
Best
Worst
Baselines
ResNet50
0.6945
± 0.0710
0.6597
0.7760
0.6465
EfficientNet-B1
0.7151
± 0.0390
0.6837
0.7602
0.6922
ConvNeXt-Tiny
0.7413
± 0.1155
0.6999
0.8711
0.6498
DenseNet-121
0.7858
± 0.0536
0.7752
0.8362
0.7295
ViT-B/16
0.7581
± 0.0940
0.7457
0.8338
0.6528
Table 4: Comprehensive Performance Evaluation of CNN-Based Backbones and Hybrid Architectures under KL Divergence Settings (No Augmentation)
Model
Test Grade
Accuracy
Precision
Recall
F1-Score
ResNet50
Grade1
0.6465
0.6511
0.6465
0.5907
Grade2
0.6609
0.6581
0.6609
0.6143
Grade3
0.7760
0.7893
0.7760
0.7741
EfficientNet-B1
Grade1
0.6930
0.7332
0.6930
0.6432
Grade2
0.6922
0.7112
0.6922
0.6539
Grade3
0.7602
0.7682
0.7602
0.7540
Table 5: Performance Comparison Across Test Grades
Model
Train Grade
Test Grade
Accuracy
Precision
Recall
F1-Score
Swin-ResNet (KL)
Grade1
Grade2
0.6044
0.4968
0.6044
0.5120
Grade1
Grade3
0.7756
0.7972
0.7756
0.7643
Grade2
Grade1
0.6177
0.4236
0.6177
0.4981
Grade2
Grade3
0.7220
0.8047
0.7220
0.6834
Grade3
Grade1
0.7108
0.7560
0.7108
0.6884
Grade3
Grade2
0.9148
0.9307
0.9148
0.9163
Table 6: Cross-Grade Generalization Results under Train-on-One-Grade (T1G) Protocol
Ablation Study
G1 Acc.
G2 Acc.
G3 Acc.
Mean Acc. ± Std
Mean F1
Best Acc.
Worst Acc.
Reference Baselines (Independent Training)
Swin-Tiny (Teacher only)
0.6654
0.7980
0.7249
0.7294 ± 0.0664
0.7118
0.7980
0.6654
ResNet50 (Student only)
0.6465
0.6609
0.7760
0.6945 ± 0.0710
0.6597
0.7760
0.6465
Ablation Variants (Isolating Components)
w/o Adaptor (Dual CE)
0.6370
0.8111
0.8719
0.7733 ± 0.1219
0.7577
0.8719
0.6370
Adaptor only (Single CE)
0.6274
0.7507
0.8621
0.7467 ± 0.1174
0.7222
0.8621
0.6274
Table 7: Ablation Study: Grade-wise and Component-wise Performance Analysis
Figure 2: Confusion Matrices for Swin-ResNet (KL) across all test grades. The strong diagonal even in Grade 1 demonstrates superior feature robustness compared to baseline CNNs.
Figure 3: Training Dynamics Matrix. The left column shows the cross-entropy loss profiles, where the close alignment of training (blue) and validation (red) curves indicates minimal overfitting. The right column illustrates the rate of loss change, where the rapid settling near zero ( ΔL≈0 ) confirms stable convergence without significant oscillations, even in the challenging Grade 1 scenario.
Model
Grade1 Test
Grade2 Test
Grade3 Test
ResNet50
25
19
12
EfficientNet-B1
19
18
17
Swin-Tiny
21
24
16
Swin-ResNet(Standard)
10
24
9
Swin-ResNet(KL)
8
8
10
Swin-EfficientNet(KL)
9
12
16
Table 8: Training Epochs Until Early Stopping
Figure 4: Grade 1 Success vs. Failure Case Study.
Figure 5: Qualitative comparison of correct and incorrect predictions for Grade 2 samples, highlighting differences in model attention and feature localization.
Figure 6: Qualitative comparison of correct and incorrect predictions for Grade 3 samples, illustrating the model?s localization capability and challenges in fine-grained discrimination.
Figure 7: Student vs. Teacher Attention Matrix. A 2 × 3 comparison across all quality grades. In each stacked image, the middle strip represents the Student’s (ResNet50) attention. The strong overlap between the Student’s focus and the relevant fruit regions indicates effective feature learning from the Teacher, even though the target layer is strictly from the ResNet50 backbone.
Grade
True Class
Sample ID
Grad-CAM IoU
Score-CAM IoU
Grade 1
Rasbale
9480
0.268
0.114
Grade 1
Elakki-bale
1623
0.313
0.202
Grade 2
Rasbale
10169
0.362
0.221
Grade 2
Elakki-bale
1905
0.375
0.017
Grade 3
Elakki-bale
2972
0.307
0.217
Grade 3
Rasbale
9392
0.176
0.337
Table 9: Teacher-Student Attention Alignment (IoU Scores) for Correct Predictions
Cross-dataset transfer in rice leaf disease classification remains a significant challenge, with models trained on one image collection performing substantially worse when deployed on another. We conduct a systematic benchmark across three Bangladeshi rice leaf disease datasets (5,419 images, 6 transfer pairs, 3 CNN backbones, 3 random seeds) to characterize and diagnose this failure. Strong augmentation recovers a mean cross-dataset macro-F1 improvement of +0.070 (Wilcoxon p < 0.001, 15 of 18 transfer pairs positive). Removing non-leaf image content via segmentation shows directional benefit (mean +0.066, p = 0.062, n = 36 paired observations) that is consistent across two independent segmentation methods but does not reach conventional significance. A self-supervised ViT control (DINOv2 linear probe) exhibits equivalent cross-dataset collapse to CNNs, ruling out architecture inductive bias as the primary driver and pointing to acquisition-condition shift. Adaptive batch normalization uniformly harms transfer performance, with harm magnitude correlating with source-target label-prior divergence and model depth (Spearman rho = 0.621, p = 0.009). Grad-CAM attribution analysis on 12 sampled predictions does not distinguish correct from incorrect cross-domain predictions (p = 0.462), indicating that common attribution proxies are insufficient for diagnosing shift at practical sample sizes. We document all frozen results, prespecified analysis criteria, and reproducibility artifacts in a public repository with SHA-256 integrity verification. This work establishes a rigorous empirical baseline for understanding cross-dataset generalization in agricultural computer vision and identifies both effective (augmentation) and ineffective (AdaBN) adaptation strategies.
Anindya Paul
Department of Computer Science and Engineering BRAC University, Dhaka, Bangladesh
Banana crop diseases threaten food security across the world, yet field diagnosis remains difficult because of limited expert access and visual similarity among disease classes. We present BananaVLM, a domain-adapted vision-language model for banana disease diagnosis built on LLaVA-v1.5-7B and fine-tuned with Low-Rank Adaptation (LoRA). To address the lack of multimodal agricultural instruction data, we introduce BananaInstruct, an automated pipeline that converts raw disease images into ≈80,000 question--answer pairs without manual annotation, using LLaVA-1.5-13B for symptom descriptions and Mistral-7B for agricultural Q&A generation and label grounding. Evaluated against 14 open-source and 5 closed-source VLMs on a nine-class benchmark, BananaVLM achieves 92.21% in-domain and 83.28% out-of-domain (OOD) classification accuracy, outperforming the best closed-source baseline, Gemini2.5Pro, by 49.8 and 63.3 percentage points, respectively. Binary healthy/diseased identification reaches 98.38% OOD accuracy with 1.00 recall. A controlled LoRA--DoRA comparison shows that DoRA performance degrades across epochs, while LoRA remains more effective for fine-grained classification. Qualitative evaluation using nine LLM judges yields G-Eval win rates of 0.81--0.96, while five domain experts prefer BananaVLM in 98.48% of 990 blind pairwise comparisons. These results show that lightweight domain adaptation with automated instruction tuning is an effective and scalable approach for specialized agricultural AI. Code, datasets, and model weights are available at https://github.com/samy101/banana-vlm
Sangam Kumar Jena, Pandarasamy Arjunan
Department of Cyber-Physical Systems Indian Institute of Science Bangalore 560 012, India
This work presents a new Hybrid Dense SwinV2, a two-branch framework that jointly leverages densely connected convolutional features and hierarchical customized Swin Transformer V2 (SwinV2) representations for cassava disease classification. The proposed framework captures high resolution local features through its DenseNet branch, preserving the fine structural cues and also allowing for effective gradient flow. Concurrently, the customized SwinV2 models global contextual dependencies through the idea of shifted-window self attention, which enables the capture of long range interactions critical in distinguishing between visually similar lesions. Moreover, an attention channel-squeeze module is employed for each CNN Transformer stream independently to emphasize discriminative disease related responses and suppress redundant or background driven activations. Finally, these discriminative channels are fused to achieve refined representations from the dense local and SwinV2 global correlated strengthened feature maps, respectively. The proposed Dense SwinV2 utilized a public cassava leaf disease dataset of 31000 images, comprised of five diseases, including brown streak, mosaic, green mottle, bacterial blight, and normal leaf conditions. The proposed Dense SwinV2 demonstrates a significant classification accuracy of 98.02 percent with an F1 score of 97.81 percent, outperforming well-established convolutional and transformer models. These results underline the fact that Hybrid Dense SwinV2 offers robustness and practicality in the field level diagnosis of cassava disease and real world challenges related to occlusion, noise, and complex backgrounds.
Shah Saood, Saddam Hussain Khan
Artificial Intelligence Lab, Department of Computer Systems Engineering, University of Engineering and Applied Sciences · Artificial Intelligence Lab, Department of Computer Systems Engineering, University of Engineering and Applied Sciences (UEAS), Swat 19060, Pakistan · Interdisciplinary Research Center for Smart Mobility and Logistics +1