In order to solve the safety and efficiency problems in the picking process of Waxberry, the slow speed and low precision of high-density Waxberry target detection under a complex background were studied. A lightweight Waxberry target detection algorithm based on YOLOv5 is studied. In this study, C3-Faster1 and C3-Faster2 modules are proposed, which are located in the backbone and neck of the network: C3-Faster1 can improve the model speed with a simple structure; C3-Faster2 integrates the context attention mechanism and transform module based on C3-Faster1 to make the network pay attention to the information of Waxberry image context and expand the channel receptive field. A new pyramid module, SPPFCSPC, is proposed to expand the sensing field and improve the accuracy of boundary detection. It also combines the Coordinate Attention (CA) and Dyhead dynamic detection head to suppress useless information and enhance the detection ability of small targets. Compared to YOLOv4, YOLOv7, and YOLOv8, mean accuracy percentage (mAP) improved by 5.7%, 9.4%, 8.3%. Compared to the base YOLOv5 model, mAP has improved from 86.5% to 91.9%, running on 2 GB Jeston nano, and the improved model is 5.03 frames per second (FPS) faster than YOLOv5. Experiments show that the designed module is more effective in Waxberry detection tasks. Waxberry is a berry plant, a type of agricultural by-product, whose harvesting problems have been affected. We improve the target detection model and innovate a new convolutional module to achieve an average accuracy of 91.6%, and the network speed we tested in Jeston nano reaches 11.86 FPS, which is in line with the development of subsequent picking robots. image