Abstract:To enhance the accuracy of mechanical harvesting of pineapples in regions with different maturity levels and ensure the quality of pineapples, a real-time pineapple ripeness detection method based on improved YOLOv8 is proposed. Addressing challenges such as small and densely packed targets and light obstruction in natural environments, this study replaces the common convolutions in the backbone and neck parts of the original YOLOv8 model with Depthwise Separable Convolutions (DSConv) to streamline model parameters. Additionally, a Convolutional Block Attention Module (CBAM) is introduced before feature fusion to prioritize important features, thereby improving the accuracy of target detection. The YOLOv8 network's original loss function, CIoU, is replaced with the EIoU loss function to expedite network convergence.Various ablation experiments are designed for different modules in the study, demonstrating the effectiveness of each improvement. The results show that the PmA of the improved model for pineapple maturity detection is 97.33%, which is 5.53, 7.91, 4.38 and 4.66 percentage points higher than that of Faster R-CNN, YOLOv4, YOLOv5 and YOLOv7, respectively. On the premise of ensuring the detection accuracy, the number of model parameters of the algorithm is only 16.8×106. The results show that the improved model improves the accuracy and inference speed of pineapple maturity recognition, and has stronger robustness.