MARATTO

article · Discover Artificial Intelligence

Explainable vision transformer for coffee leaf nutrient deficiency detection with rule-based treatment recommendation

2026Open accessGondar University

In plain language

Coffee is a vital agricultural crop, but nutritional deficiencies in leaves harm plant health and yield, requiring prompt and accurate diagnosis. Deep learning approaches often struggle with shared deficiency symptoms, scarce data, and weak interpretability. To address these issues, an Explainable Vision Transformer system was developed to identify nutrient deficiencies from leaf images and suggest treatments through an expert-defined rule-based module. Data variety was enhanced through preprocessing and class-wise augmentation. The vision transformer model achieved 94 per cent accuracy on the original data and 96 per cent following augmentation, outperforming several standard baseline networks. Visualisations via Grad-CAM verified that the system focuses on relevant symptom areas, improving interpretability. Furthermore, the treatment recommendation module demonstrated a 93.72 per cent end-to-end success rate alongside high agreement with agricultural specialists, offering a practical framework for coffee nutrient management.

Key takeaways

  • The Explainable Vision Transformer model achieved 96 per cent classification accuracy on augmented coffee leaf data.
  • The system outperformed standard baseline architectures, including ResNet-50, EfficientNet-B4, and ConvNeXt.
  • Grad-CAM visualisations confirmed that the model focuses on relevant symptom areas linked to specific nutrient deficits.
  • The rule-based module delivered a 93.72 per cent end-to-end recommendation success rate with high agreement among agricultural specialists.

Why it matters

Nutrient deficiencies reduce coffee crop productivity, yet diagnosing them accurately remains difficult because visual symptoms frequently overlap. By pairing high-accuracy image recognition with explainable visual evidence and expert-aligned treatment advice, this approach helps demystify artificial intelligence decisions for growers. It offers a practical route towards more precise, reliable fertiliser management to safeguard plant health and yields.

Commercialisation angle

This applied and tested framework could enable automated diagnostic tools for coffee farmers, agronomists, and digital extension services. By coupling visual classification with treatment guidelines, it can be integrated into mobile or precision agriculture platforms. While validated against expert recommendations and benchmark models in experimental tests, transitioning to field deployment will require adapting the software for real-time farm environments and diverse field conditions.

AI-generated from the published abstract. Always read the original work before citing.

Abstract

Coffee is a worldwide significant agricultural commodity, but nutritional deficits in coffee leaves impair plant health and output, necessitating early and correct diagnosis. Existing deep learning algorithms confront limitations such as common deficiency symptoms, limited datasets, and poor interpretability. This study presents an Explainable Vision Transformer (XViT)-based system for detecting coffee leaf nutrient deficiencies and making rule-based treatment recommendations. The approach improves data variety by preprocessing and class-wise augmentation, whereas XViT collects global and detailed visual patterns for classification. An expert-defined rule-based module makes suitable treatment recommendations, while Grad-CAM visualization enhances model clarity by emphasizing key symptom locations. Experimental results show that the proposed XViT model regularly outperforms baseline architectures such as ResNet-50, EfficientNet-B4, and ConvNeXt. On the initial dataset, XViT achieved 94% precision, 91% recall, 92% F1-score, and accuracy of 94 ± 0.37%, whereas augmentation improved accuracy to 96 ± 0.29%. The rule-based recommendation module achieved 100% rule coverage, 100% rule consistency, a 93.72% end-to-end recommendation success rate, and a Cohen’s Kappa agreement of 0.93 among agricultural specialists. Grad-CAM study indicated that the model concentrates on significant symptom regions linked with nutrient deficits, hence increasing transparency and reliability. Overall, the proposed framework for precision coffee nutrient management is accurate, explainable, and practical since it combines deep learning-based diagnosis with expert-guided treatment.

Research topics

  • Coffee research and impacts
  • Banana Cultivation and Research
  • Smart Agriculture and AI

Sustainable Development Goals

Read the original research

This page summarises published work. The authoritative version sits with the publisher.

DOI: 10.1007/s44163-026-02160-9

Is something wrong with this record? Report it or request removal.

Discussion

Discuss this research

Have you built on this work, tried to replicate it, or seen it applied in practice? Share what you know. Verified researchers and MARATTO™ domain experts can open a discussion, and any member can reply. Contributions are reviewed before they appear.

No discussion yet. Open the first thread.