← Papers

Paper record

MaizeFormerX: a lightweight vision transformer with cross-scale attention for explainable maize leaf disease diagnosis.

Rahman MM, Gony MN, Ullah MS, Shuvra SMK, Haque R, Ahmed MR, Masfequier SM, Swapno R, Murugappan M, Chowdhury MEH, Nair G, Saravanan V.

Scientific reports · 26 Mar 2026 · 10.1038/s41598-026-44550-0

Abstract

Early detection of maize leaf diseases is essential to prevent yield losses. Existing vision-based models face challenges in real-world environments due to data imbalance, lighting variations, and interpretability. This study presents MaizeFormerX, a lightweight Vision Transformer designed for cross-domain, explainable maize disease detection on resource-limited settings. MaizeFormerX employs multi-scale patch embeddings and a Cross-Scale Attention Fusion (CSAF) module to capture both detailed lesion textures and larger disease patterns. The CSAF output is processed through a transformer encoder stack using multi-head self-attention to model long-range dependencies. Robust preprocessing and dataset-specific augmentations were applied to improve feature extraction and address class imbalances in the Dataverse, Tanzania, and Plagues Maiz datasets. For interpretability, Grad-CAM was used for pixel-level saliency mapping in an efficient web application. When benchmarked against MobileViT, EfficientFormer, TinyViT, and Swin Transformer, MaizeFormerX achieved 97.8% accuracy on Dataverse, 97.5% on Tanzania, and 96.9% on Plagues Maiz, outperforming Swin Transformer V2 by 2–3%. Cross-domain testing yielded 88.9% accuracy when trained on Dataverse and tested on Tanzania, surpassing baseline performance by 3–6%. Class-wise analysis revealed F1 scores over 98% for Healthy and MLB classes with 6× augmentation, and over 97% for MSV. Ablation studies highlighted the significance of the cross-scale attention module for high MCC during domain shifts. This study introduces a precise, explainable, and efficient image-based method for classifying maize diseases, which could aid in more targeted crop management, reduce unnecessary agrochemical use, and promote sustainable maize production in future decision-support environments.

Code and data availability

The paper's Data Availability statement explicitly lists three public maize leaf image datasets used for its phenotyping/disease-classification experiments (Dataverse, Tanzania/Mendeley, Plagues Maiz/figshare) and an authors' GitHub repository containing all code, preprocessing pipelines, and experimental configs. All四

Datasetpublic

The datasets used in this study are publicly available and sourced from Dataverse (https://doi.org/10.7910/DVN/LPGHKK)

Open resource ↗Dataverse · 10.7910/DVN/LPGHKK · html-lines:2304-2339
Codepublic

All code, preprocessing pipelines, and experimental configurations used in this work are available at: https://github.com/rezaul-h/MaizeFormerX/.

Open resource ↗github · rezaul-h/MaizeFormerX · html-lines:2304-2339