In response to the problems of low detection accuracy and inaccurate positioning in traditional YOLO algorithms for fruit detection tasks, this paper proposes an improved method -replacing the original loss function of YOLOV7 with the AlphaIoU loss function, and optimizing the boundary box regression of the model. This can accelerate the convergence speed of the model and improve training accuracy. Through experimental verification, it was found that the improved YOLOV7-tiny model significantly improved the average accuracy, accuracy, and recall in fruit detection tasks compared to the original network. This indicates that this method has good performance in solving the problems of traditional YOLO algorithm, providing better performance and accuracy for fruit detection tasks, and contributing to the further development of applications and research in related fields.