Lightweight Method for Identifying Farmland Weeds Based on YOLO v5

JI Wenli, LIU Zhou, XING Haihua


The disadvantage of the existing weed recognition models for a variety of small target weeds is that they are low recognition rate, large volume, many parameters and slow detection speed in complex farmland environment. In order to solve this problem, a lightweight weed recognition method was proposed based on YOLO v5 model. Firstly, the multi-scale retinex with color restoration (MSRCR) algorithm was used to preprocess part of the image data to improve the image definition with blurred edge details and reduce the shadow interference in the image. On this basis, the feature extraction network in the recognition model was reset by using the lightweight network PP-LCNet to reduce the amount of model parameters. Secondly, the Ghost convolution model lightweight feature fusion network was used to further reduce the amount of calculation. In order to make up for the loss of model performance caused by lightweight, a normalization-based attention module (NAM) was added at the end of the feature fusion network to enhance the feature extraction ability of the model for weeds and corn seedlings. Finally, the activation function of the attention mechanism of the backbone network was optimized to improve the nonlinear fitting ability of the model. Experiments were carried out on the self-built dataset. The experimental results showed that compared with the current mainstream target detection algorithm YOLO v5s and the mature lightweight target detection algorithms MobileNetv3-YOLO v5s and ShuffleNet v2-YOLO v5s, the volume of the lightweight weed recognition model was 6.23MB, which was reduced by 54.5%, 12% and 18%, respectively. The mean average precision (mAP) was 97.8%, which was increased by 1.3 percentage points, 5.1 percentage points, and 4.4 percentage points, respectively. The detection time of single image was 118.1ms, which achieved the requirement of lightweight. It could significantly reduce the complexity of the model while maintaining high model recognition accuracy. The proposed method could identify corn seedling and weed accurately and rapidly, which provided technical support for the use of mobile devices with limited resources for farmland weed recognition.

Keywords: weed recognition, target detection, YOLO v5s, lightweight feature extraction network, Ghost convolution module  attention mechanisms


Download Full Text:



WANG A С, ZHANG W, WEI X H. A review on weed detection using ground-based machine vision and image processing techniques [J ]. Computers and Electronics in Agriculture, 2019, 158: 226 -240.

LIU Mochen, GAO Tiantian, MA Zongxu,et al. Target detection model of corn weeds in field environment based on MSRCR algorithm and YOLOv4 — tiny [ J ]. Transactions of the Chinese Society for Agricultural Machinery ,2022 ,53 (2 ) :246 -255,335. (in Chinese)

PENG Wen, LAN Yubin, YUE Xuejun, et al. Research on paddy weed recognition based on deep convolutional neural network [J]. Journal of South China Agricultural University ,2020 ,41 (6) :75 -81. (in Chinese)

YUAN Hongbo, ZHAO Nudong, CHENG Man. Review of weeds recognition based on image processing [J] . Transactions of the Chinese Society for Agricultural Machinery, 2020,51(2) :323 -334. (in Chinese)

LIU B, BRUCH R. Weed detection for selective spraying: a review [ J], Current Robotics Reports, 2020( 1 ) ; 19 -26.

WANG Z, GUO J, ZHANG S. Lightweight convolution neural network based on multi-scale parallel fusion for weed identification[ J]. International Journal of Pattern Recognition and Artificial Intelligence, 2022, 36(7); 2250028.

PETEINATOS G G, REICHEL P, KAROUTA J, et al. Weed identification in maize, sunflower, and potatoes with the aid of convolutional neural networks [ J ] . Remote Sensing, 2020, 12(24): 4185.

BAKHSHIPOUR A, JAFARI A. Evaluation of support vector machine and artificial neural networks in weed detection using shape features [j ]. Computers & Electronics in Agriculture, 2018, 145: 153 - 160.

DENG Xiangwu, QI Long, MA Xu, et al. Recognition of weeds at seedling stage in paddy fields using multi-feature fusion and deep belief networks [ J ]. Transactions of the CSAE,2018 ,34 ( 14) : 165 - 172. (in Chinese)

SUN Yanxia, CHEN Yanfei, JIN Xiaojun, et al. al. AI differentiation of Bok choy seedlings from weeds[ J]. Fujian Journal of Agricultural Sciences,2021 ,36( 12) ;1484 - 1490. (in Chinese)

SUN Jun, TAN Wenjun, WU Xiaohong, et al. Real-time recognition of sugar beet and weeds in complex backgrounds using multi-channel depth-wise separable convolution model [J] . Transactions of the CSAE, 2019, 35 ( 12 ): 184 - 190. ( in Chinese)

WANG С Y, BOCHKOVSKIY A, LIAO H. Scaled — YOLOv4: scaling cross stage partial network [ C] // Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition, 2021 ; 13029 - 13038.

MENG Qingkuan, ZHANG Man, YANG Xiaoxia, et al. Recognition of maize seedling and weed based on light weight convolution and feature fusion [J]. Transactions of the Chinese Society for Agricultural Machinery,2020,51 (12) :238 -245, 303. (in Chinese)

WANG Zhuo, WANG Jian, WANG Xiaoxiong, et al. Lightweight real-time apple detection method based on improved YOLO v4[J]. Transactions of the Chinese Society for Agricultural Machinery ,2022 ,53 (8) : 294 -302. (in Chinese)

XU Yanlei, HE Run, ZHAI Yuting, et al. Weed identification method based on deep transfer learning in field natural environment [J]. Journal of Jilin University ( Engineering and Technology Edition) ,2021 ,51(6) ;2304 -2312. ( in Chinese)

KANG Jie, LIU Gang, WANG Qing, et al. Weed detection algorithm based on dynamic pruning neural network [ J]. Transactions of the Chinese Society for Agricultural Machinery, 2023,54(4) ;269 -277. (in Chinese)

YANG Wenjing, CHEN Ming, FENG Guofu. Fish recognition method for underwater video based on image enhancement [ J ] . Laser & Optoelectronics Progress,2021 ,58(22) ;294 -303. (in Chinese)

LUO Zhicong, LI Pengbo, SONG Feiyu, et al. Lightweight passion fruit detection model based on embedded device [ J ]. Transactions of the Chinese Society for Agricultural Machinery ,2022 ,53 ( 11 ) :262 -269,322. ( in Chinese)


  • There are currently no refbacks.