Weed detection and recognition in complex wheat fields based on an improved YOLOv7

Weed detection and recognition in complex wheat fields based on an improved YOLOv7

24 June 2024 | Kaixin Wang, Xihong Hu, Huiwen Zheng, Maoyang Lan, Changjiang Liu, Yihui Liu, Lei Zhong, Hai Li* and Suiyan Tan*
This study addresses the challenge of precise weed detection in complex wheat fields, where weeds and wheat have similar colors, morphologies, and can be occluded by each other. An improved YOLOv7 model, named CSCW-YOLOv7, was developed to identify five types of weeds: *Descurainia sophia*, thistle, golden saxifrage, shepherd’s purse herb, and *Artemisia argyi*. The CSCW-YOLOv7 model incorporates several enhancements to improve weed detection accuracy: 1. **CARAFE Operator**: Introduced as an up-sampling algorithm to enhance the recognition of small targets. 2. **SE Attention Mechanism**: Added to the Extended Latent Attention Networks (ELAN) module to enhance important weed features and suppress irrelevant features. 3. **Contextual Transformer (CoT) Module**: Replaced the ELAN module in the Neck to capture global information and enhance self-attention by mining contextual information between neighboring keys. 4. **Wise Intersection over Union (WIoU) Loss Function**: Used to better predict the bounding boxes of occluded weeds, introducing a dynamic non-monotonic focusing mechanism. The performance of the CSCW-YOLOv7 model was evaluated using precision, recall, and mean average precision (mAP) metrics. The results showed that the CSCW-YOLOv7 achieved the best performance among the compared models, with mAP values of 94.4%, precision of 97.7%, and recall of 98%. Compared to the baseline YOLOv7, the CSCW-YOLOv7 improved precision, recall, and mAP by 1.8%, 1%, and 2.1%, respectively, while reducing parameters by 10.7% and FLOPs by 10%. The Grad-CAM visualization method confirmed that the CSCW-YOLOv7 learned more representative features, aiding in the accurate detection of weeds of different scales in complex field environments. The model was also compared with other deep learning models, demonstrating superior performance in detecting small-scale and occluded weeds.This study addresses the challenge of precise weed detection in complex wheat fields, where weeds and wheat have similar colors, morphologies, and can be occluded by each other. An improved YOLOv7 model, named CSCW-YOLOv7, was developed to identify five types of weeds: *Descurainia sophia*, thistle, golden saxifrage, shepherd’s purse herb, and *Artemisia argyi*. The CSCW-YOLOv7 model incorporates several enhancements to improve weed detection accuracy: 1. **CARAFE Operator**: Introduced as an up-sampling algorithm to enhance the recognition of small targets. 2. **SE Attention Mechanism**: Added to the Extended Latent Attention Networks (ELAN) module to enhance important weed features and suppress irrelevant features. 3. **Contextual Transformer (CoT) Module**: Replaced the ELAN module in the Neck to capture global information and enhance self-attention by mining contextual information between neighboring keys. 4. **Wise Intersection over Union (WIoU) Loss Function**: Used to better predict the bounding boxes of occluded weeds, introducing a dynamic non-monotonic focusing mechanism. The performance of the CSCW-YOLOv7 model was evaluated using precision, recall, and mean average precision (mAP) metrics. The results showed that the CSCW-YOLOv7 achieved the best performance among the compared models, with mAP values of 94.4%, precision of 97.7%, and recall of 98%. Compared to the baseline YOLOv7, the CSCW-YOLOv7 improved precision, recall, and mAP by 1.8%, 1%, and 2.1%, respectively, while reducing parameters by 10.7% and FLOPs by 10%. The Grad-CAM visualization method confirmed that the CSCW-YOLOv7 learned more representative features, aiding in the accurate detection of weeds of different scales in complex field environments. The model was also compared with other deep learning models, demonstrating superior performance in detecting small-scale and occluded weeds.
Reach us at info@study.space
[slides and audio] Weed detection and recognition in complex wheat fields based on an improved YOLOv7