Explainable vision transformers for real‑time chili and onion leaf disease identification and diagnosis
Early identification of leaf diseases in chili and onion crops is crucial for maintaining agricultural productivity and reducing economic losses. This study proposes a transformer-based deep learning framework for the multi-class classification of common leaf diseases affecting chili and onion plants. It addresses challenges related to intra-class similarity, complex backgrounds, and variations in real-world imaging. We collected a curated dataset consisting of 13,989 high-resolution images—10,987 of chili leaves and 4,502 of onion leaves—from actual agricultural environments in Karnataka, India. This dataset covers nine disease classes, including Cercospora, purple blotch, Iris yellow spot virus, and powdery mildew. To enhance model generalization, we applied extensive preprocessing techniques, including resizing, normalization, augmentation, and noise injection. We evaluated four state-of-the-art transformer architectures: MaxViT, Swin Transformer, Hornet, and EfficientFormer. Among these, MaxViT achieved the highest performance, with classification accuracies of 95.75% on the onion dataset and 90.86% on the chili dataset, along with high F1 scores, Matthews Correlation Coefficient (MCC), and Precision-Recall Area Under Curve (PR-AUC) values. To enable practical use in the field, we developed a real-time web application using Django. This application allows users to upload leaf images and receive instant predictions, supplemented by Grad-CAM-based visual explanations. This integration of explainable AI (XAI) enhances transparency and builds trust among end-users, such as farmers and agronomists. The results highlight the effectiveness of transformer-based models for agricultural disease diagnosis and provide a scalable, interpretable, and deployable solution for precision farming.
Institutions
- American University (US)
- University of Alabama in Huntsville (US)
Publication Details
- Journal
- Zenodo (CERN European Organization for Nuclear Research)
- Published
- 2025-04-30
- DOI
- https://doi.org/10.5281/zenodo.17151400
- Primary Topic
- Geochemistry and Geologic Mapping
- Type
- article
- Field-Weighted Citation Impact
- 0.00