Abstract:In the task of apple recognition in natural orchard environments, it is difficult for traditional object detection algorithms to achieve a balance between the accuracy, speed, and lightweight of the detection model. Therefore, a lightweight apple detection model based on improved YOLO v7 model was proposed. Firstly, partial convolution (PConv) was introduced in the multi branch stacking module to replace regular convolution, in order to reduce the parameter and computation of the model. Then a lightweight efficient channel attention (ECA) module was introduced to enhance the feature extraction ability and improve the problem of false and missed detection of occluded targets in complex environments. Finally, a learning rate optimization strategy based on sparrow search algorithm (SSA) was adopted in model training to further increase the detection accuracy of the model. The experimental results showed that compared with the original YOLO v7 model, the precision, recall, and average accuracy of the improved model was raised by 4.15 percentage points, 0.38 percentage points and 1.39 percentage points respectively; the number of parameters and computations were decreased by 2293% and 27.41%, respectively; and the average time to detect each image under GPU and CPU was decreased by 0.003s and 0.014s, respectively. The results indicated that the improved model can quickly and accurately detect apple fruits in natural orchard environments, and the number of parameters and computations were less, which was suitable to be deployed on the embedded devices of apple harvesting robots, and laying the foundation for unmanned intelligent apple picking.