Processing Plant Diseases Using Transformer Model

Hong Zheng Marcus Lye - Multimedia University, 63100 Cyberjaya, Selangor, Malaysia
Kok Why Ng - Multimedia University, 63100 Cyberjaya, Selangor, Malaysia

Citation Format:



Agriculture faces challenges in achieving high-yield production while minimizing the use of chemicals. The excessive use of chemicals in agriculture poses many problems. Accurate disease diagnosis is crucial for effective plant disease detection and treatment. Automatic identification of plant diseases using computer vision techniques offers new and efficient approaches compared to traditional methods. Transformers, a type of deep learning model, have shown great promise in computer vision, but as the technology is still new, many vision transformer models struggle to identify diseases by examining the entire leaf. This paper aims to utilize the vision transformer model in analyzing and identifying common diseases that hinder the growth and development of plants through the plant leave images. Besides, it aims to improve the model's stability by focusing more on the entire leaf than individual parts and generalizing better results on leaves not in the image center. Added features such as Shift Patch Tokenization, Locality Self Attention, and Positional Encoding help focus on the whole leaf. The final test accuracy obtained is 89.58%, with relatively slight variances in precision, accuracy, and F1 score across classes, as well as satisfactory model robustness towards changes in leaf orientation and position within the image. The model's effectiveness shows the vision transformer's potential for automated plant disease diagnosis, which can help farmers take timely measures to prevent losses and ensure food security.


Vision Transformer; Deep Learning; Plant Disease; Computer Vision

Full Text:



B. S. Bari., “A real-time approach of diagnosing rice leaf disease using deep learning-based faster R-CNN framework,” PeerJ Comput Sci, vol. 7, 2021, doi: 10.7717/PEERJ-CS.432.

M. Y. Xin, L. W. Ang, and S. Palaniappan. “A Data Augmented Method for Plant Disease Leaf Image Recognition based on Enhanced GAN Model Network.” Journal of Informatics and Web Engineering vol. 2, no. 1, pp. 1-12, 2023. doi: 10.33093/jiwe.2023.2.1.1

G. B.V. and U. D. G., “Identifying and classifying plant disease using resilient LF-CNN,” Ecol Inform, vol. 63, Jul. 2021, doi: 10.1016/j.ecoinf.2021.101283.

J. Zhang, Y. Rao, C. Man, Z. Jiang, and S. Li, “Identification of cucumber leaf diseases using deep learning and small sample size for agricultural Internet of Things,” Int J Distrib Sens Netw, vol. 17, no. 4, 2021, doi: 10.1177/15501477211007407.

M. Hammad Saleem, S. Khanchi, J. Potgieter, and K. Mahmood Arif, “Image-based plant disease identification by deep learning meta-architectures,” Plants, vol. 9, no. 11, pp. 1–23, Nov. 2020, doi: 10.3390/plants9111451.

X. Li and S. Li, “Transformer Help CNN See Better: A Lightweight Hybrid Apple Disease Identification Model Based on Transformers,” Agriculture (Switzerland), vol. 12, no. 6, Jun. 2022, doi: 10.3390/agriculture12060884.

M. A. Genaev, E. S. Skolotneva, E. I. Gultyaeva, E. A. Orlova, N. P. Bechtold, and D. A. Afonnikov, “Image-based wheat fungi diseases identification by deep learning,” Plants, vol. 10, no. 8, Aug. 2021, doi: 10.3390/plants10081500.

J. Chen, D. Zhang, A. Zeb, and Y. A. Nanehkaran, “Identification of rice plant diseases using lightweight attention networks,” Expert Syst Appl, vol. 169, May 2021, doi: 10.1016/j.eswa.2020.114514.

R. Reedha, E. Dericquebourg, R. Canals, and A. Hafiane, “Transformer Neural Network for Weed and Crop Classification of High Resolution UAV Images,” Remote Sens (Basel), vol. 14, no. 3, Feb. 2022, doi: 10.3390/rs14030592.

H. T. Thai, N. Y. Tran-Van, and K. H. Le, “Artificial Cognition for Early Leaf Disease Detection using Vision Transformers,” in International Conference on Advanced Technologies for Communications, IEEE Computer Society, 2021, pp. 33–38. doi: 10.1109/ATC52653.2021.9598303.

Y. Xiong, L. Liang, L. Wang, J. She, and M. Wu, “Identification of cash crop diseases using automatic image segmentation algorithm and deep learning with expanded dataset,” Comput Electron Agric, vol. 177, Oct. 2020, doi: 10.1016/j.compag.2020.105712.

Z. Zhang, Z. Gong, Q. Hong, and L. Jiang, “Swin-Transformer Based Classification for Rice Diseases Recognition,” in Proceedings - 2021 International Conference on Computer Information Science and Artificial Intelligence, CISAI 2021, Institute of Electrical and Electronics Engineers Inc., 2021, pp. 153–156. doi: 10.1109/CISAI54367.2021.00036.

Y. Borhani, J. Khoramdel, and E. Najafi, “A deep learning based approach for automated plant disease classification using vision transformer,” Sci Rep, vol. 12, no. 1, Dec. 2022, doi: 10.1038/s41598-022-15163-0.

W. Zhu, J. Sun, S. Wang, J. Shen, K. Yang, and X. Zhou, “Identifying Field Crop Diseases Using Transformer-Embedded Convolutional Neural Network,” Agriculture (Switzerland), vol. 12, no. 8, Aug. 2022, doi: 10.3390/agriculture12081083.

S. Zhang, S. Zhang, C. Zhang, X. Wang, and Y. Shi, “Cucumber leaf disease identification with global pooling dilated convolutional neural network,” Comput Electron Agric, vol. 162, pp. 422–430, Jul. 2019, doi: 10.1016/j.compag.2019.03.012.

J. G. Arnal Barbedo, “Plant disease identification from individual lesions and spots using deep learning,” Biosyst Eng, vol. 180, pp. 96–107, Apr. 2019, doi: 10.1016/j.biosystemseng.2019.02.002.

A. F. Fuentes, S. Yoon, J. Lee, and D. S. Park, “High-performance deep neural network-based tomato plant diseases and pests diagnosis system with refinement filter bank,” Front Plant Sci, vol. 9, Aug. 2018, doi: 10.3389/fpls.2018.01162.

P. Sharma, Y. P. S. Berwal, and W. Ghai, “Performance analysis of deep learning CNN models for disease detection in plants using image segmentation,” Information Processing in Agriculture, vol. 7, no. 4, pp. 566–574, Dec. 2020, doi: 10.1016/j.inpa.2019.11.001.

A. M. Roy and J. Bhaduri, “A Deep Learning Enabled Multi-Class Plant Disease Detection Model Based on Computer Vision,” AI (Switzerland), vol. 2, no. 3, pp. 413–428, Sep. 2021, doi: 10.3390/ai2030026.

S. Wu, Y. Sun, and H. Huang, “Multi-granularity Feature Extraction Based on Vision Transformer for Tomato Leaf Disease Recognition,” in 2021 3rd International Academic Exchange Conference on Science and Technology Innovation, IAECST 2021, Institute of Electrical and Electronics Engineers Inc., 2021, pp. 387–390. doi: 10.1109/IAECST54258.2021.9695688.

J. A. Pandian, V. D. Kumar, O. Geman, M. Hnatiuc, M. Arif, and K. Kanchanadevi, “Plant Disease Detection Using Deep Convolutional Neural Network,” Applied Sciences (Switzerland), vol. 12, no. 14, Jul. 2022, doi: 10.3390/app12146982.

D. Wang, J. Wang, W. Li, and P. Guan, “T-CNN: Trilinear convolutional neural networks model for visual detection of plant diseases,” Comput Electron Agric, vol. 190, Nov. 2021, doi: 10.1016/j.compag.2021.106468.

D. Argüeso et al., “Few-Shot Learning approach for plant disease classification using images taken in the field,” Comput Electron Agric, vol. 175, Aug. 2020, doi: 10.1016/j.compag.2020.105542.

A. Dosovitskiy et al., “An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale,” Oct. 2020, [Online]. Available:

S. H. Lee, H. Goëau, P. Bonnet, and A. Joly, “New perspectives on plant disease characterization based on deep learning,” Comput Electron Agric, vol. 170, Mar. 2020, doi: 10.1016/j.compag.2020.105220.

S. Ramesh and D. Vydeki, “Recognition and classification of paddy leaf diseases using Optimized Deep Neural network with Jaya algorithm,” Information Processing in Agriculture, vol. 7, no. 2, pp. 249–260, Jun. 2020, doi: 10.1016/j.inpa.2019.09.002.

J. Annrose, N. H. A. Rufus, C. R. E. S. Rex, and D. G. Immanuel, “A Cloud-Based Platform for Soybean Plant Disease Classification Using Archimedes Optimization Based Hybrid Deep Learning Model,” Wirel Pers Commun, vol. 122, no. 4, pp. 2995–3017, Feb. 2022, doi: 10.1007/s11277-021-09038-2.

M. Agarwal, S. K. Gupta, and K. K. Biswas, “Development of Efficient CNN model for Tomato crop disease identification,” Sustainable Computing: Informatics and Systems, vol. 28, Dec. 2020, doi: 10.1016/j.suscom.2020.100407.

R. and I. T. Association of Knowledge, Jāmiʻat Ibn Zuhr. École nationale des sciences appliquées d’Agadir, and Institute of Electrical and Electronics Engineers, Proceedings of 2019 International Conference of Computer Science and Renewable Energies (ICCSRE) : 2019 July 22-24.

Institute of Electrical and Electronics Engineers and Hindusthan Institute of Technology, Proceedings of the International Conference on Electronics and Sustainable Communication Systems (ICESC 2020) : 02-04, July 2020.