Aiming at the low detection rate,missed detections,and false detections in weed detection,an improved weed detection algorithm based on YOLOv8 is proposed.Add variable convolution to the backbone network and intro-duce learnable convolution kernels to effectively improve the recognition rate of weeds;Introducing the GCNet global attention mechanism,the model focuses more attention on the weeds to be detected,reducing missed and false detec-tion rates.Constructing a weed dataset and conducting experimental verification,the results showed that the improved algorithm improved accuracy and recall by 2.7%、2.2%and 5.5%respectively.It can effectively solve the problems of missed and false detections in weed detection,achieve precise weed detection,and provide reference for the de-velopment of intelligent weed control robots.