The rapid and accurate detection of weeds is the prerequisite and foundation for precision weeding, automation, and intelligent field operations. Due to the wide variety of weeds in the field and their significant morphological differences, most existing detection methods can only recognize major crops and weeds, with a pressing need to enhance accuracy. This study introduces a novel weed detection approach that integrates the GFPN (Green Feature Pyramid Network), Slide Loss, and multi-SEAM (Spatial and Enhancement Attention Modules) to enhance accuracy and improve efficiency. This approach recognizes crop seedlings utilizing an improved YOLO v8 algorithm, followed by the reverse detection of weeds through graphics processing technology. The experimental results demonstrated that the improved YOLO v8 model achieved remarkable performance, with an accuracy of 92.9%, a recall rate of 87.0%, and an F1 score of 90%. The detection speed was approximately 22.47 ms per image. And when shooting from a height ranging from 80 cm to 100 cm in the field test, the crop detection effect was the best. This reverse weed detection method addresses the challenges posed by weed diversity and complexities in image recognition modeling, thereby contributing to the enhancement of automated and intelligent weeding efficiency and quality. It also provides valuable technical support for precision weeding in farmland operations.