Classifying pests in crop images using deep learning

  • Gabriel Sávio de Lima Mota UFV
  • Leandro H. F. P. Silva UFV
  • Larissa Ferreira Rodrigues Moreira UFV
  • João Fernando Mari UFV


Pest control is essential for agricultural success, and rapid and accurate pest identification through computer vision and machine learning enables effective pest management. This paper proposes an approach to evaluate nine customizations of the IP102 dataset. Considering the extensive range of sub-datasets, a comparative analysis was conducted between different deep learning models, including ResNet and AlexNet Convolutional Neural Networks (CNNs), and Vision Transform (ViT). We carried out tests considering training from scratch and fine-tuning. Our experimental results demonstrate that ViT outperforms CNN models for the problem investigated and benefits significantly from data augmentation strategies. Our study provides valuable insights for efficient pest classification, paving the way for future research and advancements in precision agriculture.

Palavras-chave: computer vision, agriculture, pest classification, deep learning, data augmentation, cutmix


H. S. Pellegrina, “Trade, productivity, and the spatial organization of agriculture: Evidence from brazil,” Journal of Development Economics, vol. 156, p. 102816, 2022.

IBGE, “Pib cresce 1,9% no 1º trimestre de 2023,” Available at: [link], 2023, access at: 07/28/2023.

M. Preti, F. Verheggen, and S. Angeli, “Insect pest monitoring with camera-equipped traps: strengths and limitations,” Journal of Pest Science, vol. 94, no. 2, pp. 203–217, Mar 2021.

W. Albattah, M. Masood, A. Javed, M. Nawaz, and S. Albahli, “Custom cornernet: a drone-based improved deep learning technique for large-scale multiclass pest localization and classification,” Complex & Intelligent Systems, vol. 9, no. 2, pp. 1299–1316, 2023.

T. Zheng, X. Yang, J. Lv, M. Li, S. Wang, and W. Li, “An efficient mobile model for insect image classification in the field pest management,” Engineering Science and Technology, an International Journal, vol. 39, p. 101335, 2023.

Agrobot. (2020) Agrobot - agricultura robótica. [Online]. Available: [link]

F. Ren, W. Liu, and G. Wu, “Feature reuse residual networks for insect pest recognition,” IEEE access, vol. 7, pp. 122 758–122 768, 2019.

H. T. Ung, H. Q. Ung, and B. T. Nguyen, “An efficient insect pest classification using multiple convolutional neural network based models,” arXiv preprint arXiv:2107.12189, 2021.

N. Ullah, J. A. Khan, L. A. Alharbi, A. Raza, W. Khan, and I. Ahmad, “An Efficient Approach for Crops Pests Recognition and Classification Based on Novel DeepPestNet Deep Learning Model,” IEEE Access, vol. 10, pp. 73 019–73 032, 2022.

S. Li, H. Wang, C. Zhang, and J. Liu, “A self-attention feature fusion model for rice pest detection,” IEEE Access, vol. 10, pp. 84 063–84 077, 2022.

L. Nanni, A. Manfè, G. Maguolo, A. Lumini, and S. Brahnam, “High performing ensemble of convolutional neural networks for insect pest image detection,” Ecological Informatics, vol. 67, p. 101515, 2022.

J. An, Y. Du, P. Hong, L. Zhang, and X. Weng, “Insect recognition based on complementary features from multiple views,” Scientific Reports, vol. 13, no. 1, p. 2966, 2023.

L. Zhang, C. Zhao, Y. Feng, and D. Li, “Pests identification of ip102 by yolov5 embedded with the novel lightweight module,” Agronomy, vol. 13, no. 6, p. 1583, 2023.

Q. Guo, C. Wang, D. Xiao, and Q. Huang, “A novel multi-label pest image classifier using the modified Swin Transformer and soft binary cross entropy loss,” Engineering Applications of Artificial Intelligence, vol. 126, p. 107060, 2023.

X. Wu, C. Zhan, Y.-K. Lai, M.-M. Cheng, and J. Yang, “Ip102: A largescale benchmark dataset for insect pest recognition,” in Proceedings of the IEEE/CVF conference on computer vision and pattern recognition, 2019, pp. 8787–8796.

A. Krizhevsky, I. Sutskever, and G. E. Hinton, “Imagenet classification with deep convolutional neural networks,” Advances in neural information processing systems, vol. 25, 2012.

K. He, X. Zhang, S. Ren, and J. Sun, “Deep residual learning for image recognition,” in Proceedings of the IEEE conference on computer vision and pattern recognition, 2016, pp. 770–778.

A. Dosovitskiy, L. Beyer, A. Kolesnikov, D. Weissenborn, X. Zhai, T. Unterthiner, M. Dehghani, M. Minderer, G. Heigold, S. Gelly et al., “An image is worth 16x16 words: Transformers for image recognition at scale,” arXiv preprint arXiv:2010.11929, 2020.

M. Xu, S. Yoon, A. Fuentes, and D. S. Park, “A Comprehensive Survey of Image Augmentation Techniques for Deep Learning,” Pattern Recognition, vol. 137, p. 109347, 2023.

S. Yun, D. Han, S. J. Oh, S. Chun, J. Choe, and Y. Yoo, “Cutmix: Regularization strategy to train strong classifiers with localizable features,” in Proceedings of the IEEE/CVF international conference on computer vision, 2019, pp. 6023–6032.
MOTA, Gabriel Sávio de Lima; SILVA, Leandro H. F. P.; MOREIRA, Larissa Ferreira Rodrigues; MARI, João Fernando. Classifying pests in crop images using deep learning. In: WORKSHOP DE VISÃO COMPUTACIONAL (WVC), 18. , 2023, São Bernardo do Campo/SP. Anais [...]. Porto Alegre: Sociedade Brasileira de Computação, 2023 . p. 42-47. DOI: