LAViT: Class-Aware Vision Transformer with Learnable Attention for Pest Recognition in Agricultural Fields
Open Access
- 24 March 2026
- journal article
- Published by Ankara University Faculty of Agriculture in Tarım Bilimleri Dergisi
- Vol. 32 (2) , 474-497
Abstract
Insect pests pose a significant threat to agricultural productivity, making early and accurate identification essential for effective pest management. This study proposes a novel deep learning-based classification framework for multi-class pest recognition from field images. The proposed approach enhances discriminative region representation by integrating a patch embedding module, a Vision Transformer backbone, and a learnable spatial attention mask. This hybrid design enables the model to focus on critical visual cues without requiring segmentation-based preprocessing. The attention mask, learned via convolutional layers, is pooled and directly applied to Transformer-encoded patch tokens to refine spatial feature emphasis. Positional embeddings are further employed to preserve spatial context within the tokenized image representation. Experimental evaluations conducted on publicly available pest datasets with 5, 9, and 12 classes demonstrate the effectiveness and robustness of the proposed framework. The model achieves accuracies of 99.67%, 99.52%, and 97.00% on the Pest5, Pest9, and Pest12 datasets, respectively, indicating strong generalization across varying classification complexities. To enhance model transparency and reliability, visual interpretability is provided through Grad-CAM and attention heatmap visualizations that reveal the model’s focus regions. Additionally, t-SNE-based feature visualization illustrates clear separability in the learned embedding space. The proposed framework shows strong potential for practical deployment in smart agriculture and precision pest monitoring systems.Keywords
This publication has 13 references indexed in Scilit:
- Hybrid AI Model With CNNs and Vision Transformers for Precision Pest Classification in CropsFood Science & Nutrition, 2025
- ROI-aware multiscale cross-attention vision transformer for pest image identificationComputers and Electronics in Agriculture, 2025
- Plant leaf disease detection using vision transformers for precision agricultureScientific Reports, 2025
- Deep learning networks-based tomato disease and pest detection: a first review of research studies using real field datasetsFrontiers in Plant Science, 2024
- Efficient agricultural pest classification using vision transformer with hybrid pooled multihead attentionComputers in Biology and Medicine, 2024
- GNViT- An enhanced image-based groundnut pest classification using Vision Transformer (ViT) modelPLOS ONE, 2024
- Deep Learning-Based Identification of Maize Leaf Diseases Is Improved by an Attention Mechanism: Self-AttentionFrontiers in Plant Science, 2022
- Crop pest recognition in natural scenes using convolutional neural networksComputers and Electronics in Agriculture, 2020
- Deep learning models for plant disease detection and diagnosisComputers and Electronics in Agriculture, 2018
- Using Deep Learning for Image-Based Plant Disease DetectionFrontiers in Plant Science, 2016