Abstract:Aiming to address the problems of small strawberry individuals and serious inter-individual occlusion, a strawberry ripeness detection method was proposed based on MSCS-YOLO in an unstructured environment. The method introduced the multi-scale dilated attention (MSDA) mechanism in the Neck part of the YOLO v8n model, which enlarged the sensory field of the model and solved the problem of small strawberry fruits and easy to ignore features. Meanwhile, the improved C2f-Triplet attention structure was utilized to replace the C2f structure in the Neck part to capture the information of the strawberry image more comprehensively from the three dimensions, which enhanced the model’s target recognition ability in the case of fruit occlusion. Embedding the improved SAHead detection head into the YOLO v8n model enhanced the model’s recognition accuracy for strawberries with different ripeness levels in unstructured environments. The experimental results showed that the MSCS-YOLO model achieved an average accuracy of 94.22% in the task of recognizing three types of strawberries: ripe, moderately ripe and unripe, which was 1.38 percentage points and 5.42 percentage points higher than that of the YOLO v8n and RTDETR-L models, respectively;among them, the accuracy of recognizing ripe and moderately ripe strawberries achieved 96.35% and 92.00%, which was 0.82 percentage points and 3.66 percentage points higher than that of the YOLO v8n model, respectively. The MSCS-YOLO model demonstrated better recognition performance and higher accuracy regardless of evening, sunny day, direct sunlight or light irradiation conditions. In addition, the model size of the improved model was 6.42 MB, which was 45.22% and 86.93% smaller than that of the YOLO v7-tiny and YOLO v9c models, respectively, and achieved the synergistic optimization of accuracy and efficiency while maintaining a similar model size with YOLO v8n. Therefore, the MSCS-YOLO model was more advantageous for deployment and application in resource-limited environments, and it can provide reliable technical support for later practical applications on strawberry maturity.