MangoSwin-attention: a swin transformer with attention pooling for generalizable mango leaf disease classification
Growing mangoes is very important to India’s economy (horticultural). However, farmers face many challenges such as fungal foliar diseases that reduce mango quality and yield. While deep learning has enabled automated disease diagnosis, current approaches are limited to using CNN’s that perform poorly due to lack of generalizability from the training set to real world applications. The limitations are attributed to the use of global average pooling layers that treat disease lesions and background noise equally, producing feature representations that do not transfer well between test and application conditions. To improve on the limitations of previous methods, we adapt an attention-based pooling head, rooted in attention-based multiple instance learning paradigms, to a Hierarchical Swin Transformer. Unlike standard pooling layers, in our method image patch importance scores are automatically learned and used for focusing attention on lesion areas while suppressing extraneous noise. We evaluated our architecture using a composite dataset of 21,932 mango leaf images across seven distinct disease categories and one healthy control class, and a different out-of-distribution dataset. The outcome of this evaluation showed that our model achieves 99.41% accuracy on the in-distribution test data. Across three test runs, the model averaged 91.00 ± 3.20% accuracy on new out-of-distribution data, compared to 87.44 ± 5.00% for the baseline Swin-Base, cutting the average generalization gap down to 8.42% from 11.94%. This 3.56%-point accuracy gain shows a positive and consistent empirical trend, though with three independent runs it does not achieve statistical significance under Welch’s t-test ( \(\:p=0.37\) ). In our single benchmark test, the model scored 90.37% versus 83.40% for the baseline, where McNemar’s test shows a clear drop in misclassifications ( p < 0.001). Therefore, we consider our hybrid architecture a more robust solution to diagnosing plant diseases in agricultural applications.
Authors
- Brindha Subburaj (ORCID: https://orcid.org/0000-0003-2173-5228)
- Valarmathi Prahasam
- Girish Subramanian
- Aishwarya Mol
- Saksham Khurana
Institutions
- Pennsylvania State University (US)
- Vellore Institute of Technology University (IN)
Publication Details
- Journal
- Scientific Reports
- Published
- 2026-10-09
- DOI
- https://doi.org/10.1038/s41598-026-74017-1
- Primary Topic
- Smart Agriculture and AI
- Type
- article
- Field-Weighted Citation Impact
- 0.00