Application of YOLOv8 Improved Model Incorporating Attentional Mechanism in Weed Identification
Main Article Content
Abstract
Accurate identification of weeds plays a pivotal role in precision agriculture, as it supports targeted herbicide application and enhances crop productivity. This paper presents an improved YOLOv8-based object detection framework that integrates a global attention mechanism to strengthen weed recognition performance. Although YOLOv8 demonstrates strong baseline accuracy and speed, it lacks sufficient global contextual modeling, which constrains its ability to capture fine-grained features in visually complex or dense field scenarios. To overcome this limitation, we incorporate a Global Attention Module (GAM) after each C2f block in the backbone, enabling the network to capture long-range dependencies and highlight semantically relevant regions. Experiments on a custom weed dataset indicate that the attention-enhanced model considerably surpasses the baseline YOLOv8 in precision, recall, and mean Average Precision (mAP), especially under challenging conditions with small-scale or overlapping targets. Furthermore, the proposed method attains a favorable trade-off between detection accuracy and computational efficiency, making it suitable for real-time smart farming applications.
Article Details

This work is licensed under a Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License.
References
Paul, A.; Ghosh, S.; Mandal, A.; Dutta, S.; Banerjee, S.; Das, S. Smart Solutions for Capsicum Harvesting: Unleashing the Power of YOLO for Detection, Segmentation, Growth Stage Classification, Counting, and Real-Time Mobile Identification. Comput. Electron. Agric. 2024, 219, 108832. https://doi.org/10.1016/j.compag.2024.108832
Badgujar, C. M.; Poulose, A.; Gan, H. Agricultural Object Detection with You Only Look Once (YOLO) Algorithm: A Bibliometric and Systematic Literature Review. Comput. Electron. Agric. 2024, 223, 109090. https://doi.org/10.1016/j.compag.2024.109090
Gerhards, R.; Andújar, D.; Hamouz, P.; Peteinatos, G. G.; Christensen, S.; Fernandez-Quintanilla, C. Advances in Site-Specific Weed Management in Agriculture—A Review. Weed Res. 2022, 62, 123–133. https://doi.org/10.1111/wre.12526
Singh, P.; Zhao, B.; Shi, Y. Computer Vision for Site-Specific Weed Management in Precision Agriculture: A Review. Agriculture 2025, 15(21), 2296. https://doi.org/10.3390/agriculture15212296
Guo, Z.; Cai, D.; Bai, J.; Xu, T.; Yu, F. Intelligent Rice Field Weed Control in Precision Agriculture: From Weed Recognition to Variable Rate Spraying. Agronomy 2024, 14, 1702. https://doi.org/10.3390/agronomy14081702
Hasan, A. S. M.; Sohel, F.; Diepeveen, D.; Laga, H.; Jones, M. G. K. A Survey of Deep Learning Techniques for Weed Detection from Images. Comput. Electron. Agric. 2021, 184, 106067. https://doi.org/10.1016/j.compag.2021.106067
Wang, A.; Zhang, W.; Wei, X. A Review on Weed Detection Using Ground-Based Machine Vision and Image Processing Techniques. Comput. Electron. Agric. 2019, 158, 226–240. https://doi.org/10.1016/j.compag.2019.02.005
Ji, X.; Yue, Z.; Yang, H.; Zhang, Z. Infrared Image Classification and Detection Algorithm for Power Equipment Based on Improved YOLOv10. IEEE Access 2024, 12, 184976–184988. https://doi.org/10.1109/ACCESS.2024.3514103
Lippi, M.; Bonucci, N.; Carpio, R. F.; Contarini, M.; Speranza, S.; Gasparri, A. A YOLO-Based Pest Detection System for Precision Agriculture. In Proc. 29th Mediterr. Conf. Control Autom. (MED); 2021; pp 342–347. https://doi.org/10.1109/MED51440.2021.9480344
Tang, Z.; Chen, Z.; Qi, F.; Zhang, L.; Chen, S. Pest-YOLO: Deep Image Mining and Multi-Feature Fusion for Real-Time Agriculture Pest Detection. In Proc. IEEE Int. Conf. Data Mining (ICDM); 2021; pp 1348–1353. https://doi.org/10.1109/ICDM51629.2021.00169
Pulipalupula, M.; Patlola, S.; Nayaki, M.; Yadlapati, M.; Das, J.; Reddy, B. R. S. Object Detection Using You Only Look Once (YOLO) Algorithm in Convolution Neural Network (CNN). In Proc. IEEE 8th Int. Conf. Convergence in Technology (I2CT); 2023; pp 1–4. https://doi.org/10.1109/I2CT57861.2023.10126213
Li, M.; Zhang, Z.; Lei, L.; Wang, X.; Guo, X. Agricultural Greenhouses Detection in High-Resolution Satellite Images Based on Convolutional Neural Networks: Comparison of Faster R-CNN, YOLOv3 and SSD. Sensors 2020, 20, 4938. https://doi.org/10.3390/s20174938
Liu, Y.; Zeng, F.; Diao, H.; Zhu, J.; Ji, D.; Liao, X.; Zhao, Z. YOLOv8 Model for Weed Detection in Wheat Fields Based on a Visual Converter and Multi-Scale Feature Fusion. Sensors 2024, 24, 4379. https://doi.org/10.3390/s24134379
Kumar, Y.; Kumar, P. Comparative Study of YOLOv8 and YOLO-NAS for Agriculture Application. In Proc. 11th Int. Conf. Signal Process. Integr. Networks (SPIN); 2024; pp 72–77. https://doi.org/10.1109/SPIN60856.2024.10511673
Liu, Q.; Lv, J.; Zhang, C. MAE-YOLOv8-Based Small Object Detection of Green Crisp Plum in Real Complex Orchard Environments. Comput. Electron. Agric. 2024, 226, 109458. https://doi.org/10.1016/j.compag.2024.109458
Huang, J.; Xia, X.; Diao, Z.; Li, X.; Zhao, S.; Zhang, J.; Zhang, B.; Li, G. A Lightweight Model for Weed Detection Based on the Improved YOLOv8s Network in Maize Fields. Agronomy 2024, 14(12), 3062. https://doi.org/10.3390/agronomy14123062
Wang, X.; Girshick, R.; Gupta, A.; He, K. Non-Local Neural Networks. In Proc. IEEE/CVF Conf. Comput. Vis. Pattern Recognit. (CVPR); 2018; pp 7794–7803. https://doi.org/10.1109/CVPR.2018.00813
Cao, Y.; Xu, J.; Lin, S.; Wei, F.; Hu, H. GCNet: Non-Local Networks Meet Squeeze-Excitation Networks and Beyond. In Proc. IEEE/CVF Int. Conf. Comput. Vis. Workshops (ICCVW); 2019; pp 1971–1980. https://doi.org/10.1109/ICCVW.2019.00246
Ji, X.; Yue, Z.; Yang, H.; Li, M.; Han, H. SCAD-DETR: An Infrared Image Detection Method for Switchgear Equipment. IEEE Internet Things J. 2025, in press. https://doi.org/10.1109/JIOT.2025.3571499
Liu, J.; Yu, E.; Li, Y.; Zhao, Y.; Mao, B. YOLO-DCPG: A Lightweight Architecture with Dual-Channel Pooling Gated Attention for Intensive Small-Target Agricultural Pest Detection. Front. Plant Sci. 2025, in press. https://doi.org/10.3389/fpls.2025.1716703
Morbekar, A.; Parihar, A.; Jadhav, R. Crop Disease Detection Using YOLO. In Proc. Int. Conf. Emerging Technol. (INCET); 2020; pp 1–5. https://doi.org/10.1109/INCET49848.2020.9153986
Marvin-DiPasquale, M.; Windham-Myers, L.; Agee, J. L.; Kakouros, E.; Kieu, L. H.; Fleck, J. A.; Alpers, C. N.; Stricker, C. A. Methylmercury Production in Sediment from Agricultural and Non-Agricultural Wetlands in the Yolo Bypass, California, USA. Sci. Total Environ. 2014, 484, 288–299. https://doi.org/10.1016/j.scitotenv.2013.09.098
Guo, A.; Jia, Z.; Wang, J.; Zhou, G.; Ge, B.; Chen, W. A Lightweight Weed Detection Model with Global Contextual Joint Features. Eng. Appl. Artif. Intell. 2024, 136, 108903. https://doi.org/10.1016/j.engappai.2024.108903
Alhawsawi, A. N.; Khan, S. D.; Rehman, F. U. Enhanced YOLOv8-Based Model with Context Enrichment Module for Crowd Counting in Complex Drone Imagery. Remote Sens. 2024, 16, 4175. https://doi.org/10.3390/rs16224175
Liu, Y.; Shao, Z.; Hoffmann, N. Global Attention Mechanism: Retain Information to Enhance Channel–Spatial Interactions. arXiv Preprint 2021, arXiv:2112.05561. https://doi.org/10.48550/arXiv.2112.05561
Ni, Z.-Y.; Wang, J.-C. A Global Attention Mechanism-Based EfficientNet Model for Road Pavement-Type Identification. Int. J. Comput. Intell. Syst. 2025, 18, 1–18. https://doi.org/10.1007/s44196-025-00842-3
Sun, X.; Wu, P.; Hoi, S. C. H. Face Detection Using Deep Learning: An Improved Faster R-CNN Approach. Neurocomputing 2018, 299, 42–50. https://doi.org/10.1016/j.neucom.2018.03.030
Liu, W.; Anguelov, D.; Erhan, D.; Szegedy, C.; Reed, S.; Fu, C.-Y.; Berg, A. C. SSD: Single Shot Multibox Detector. In Proc. Eur. Conf. Comput. Vis. (ECCV); 2016; pp 21–37. https://doi.org/10.1007/978-3-319-46448-0_2
Khanam, R.; Hussain, M. YOLOv11: An Overview of the Key Architectural Enhancements. arXiv Preprint 2024, arXiv:2410.17725. https://doi.org/10.48550/arXiv.2410.17725
Lai, Y. CBAM-Enhanced YOLOv8: An Attention-Based Approach for Tomato Disease Detection. In Proc. 2nd Int. Symp. Agric. Eng. Biol. (ISAEB); 2025; pp 337–346. https://doi.org/10.2991/978-94-6463-910-0_36